From c85c0242c5f2abd54542bebd63ab8c6ef80ce29f Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sat, 14 May 2022 20:02:15 +0200 Subject: [PATCH] fix type issue --- ISBPL.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ISBPL.java b/ISBPL.java index 160fa41..caa34b4 100644 --- a/ISBPL.java +++ b/ISBPL.java @@ -99,6 +99,8 @@ public class ISBPL { ISBPLObject array = stack.pop(); array.checkTypeMulti(getType("array"), getType("string")); String[] allowed; + if(debug) + System.out.println("try with " + array); if(array.type.name.equals("string")) { allowed = new String[] { toJavaString(array) }; } @@ -210,7 +212,7 @@ public class ISBPL { ISBPLType type = registerType(typename); for(; !words[idx].equals("{"); idx++) { - ISBPLType t = getType(words[idx]); + ISBPLType t = getType(words[idx].startsWith("\"") ? words[idx].substring(1) : words[idx]); if(!type.superTypes.contains(t)) type.superTypes.add(t); } @@ -243,6 +245,8 @@ public class ISBPL { } } stack.push(new ISBPLObject(getType("int"), type.id)); + if(debug) + System.err.println("Constructing type " + type); return i.get(); }; case "string!": @@ -1796,6 +1800,8 @@ class ISBPLType { return "ISBPLType{" + "id=" + id + ", name='" + name + '\'' + + ", superTypes=" + superTypes + + ", methods=" + methods + '}'; } } @@ -1842,9 +1848,9 @@ class ISBPLObject { Queue types = new LinkedList<>(); types.add(type); while (!types.isEmpty()) { - type = types.poll(); - types.addAll(type.superTypes); - if(type.id == wanted.id) { + ISBPLType t = types.poll(); + types.addAll(t.superTypes); + if(t.id == wanted.id) { return; } } @@ -1858,9 +1864,9 @@ class ISBPLObject { Queue types = new LinkedList<>(); types.add(type); while (!types.isEmpty()) { - type = types.poll(); - types.addAll(type.superTypes); - if(type.id == wanted[i].id) { + ISBPLType t = types.poll(); + types.addAll(t.superTypes); + if(t.id == wanted[i].id) { return; } }