diff options
Diffstat (limited to 'minijava/TypeCheckSimp.java')
-rw-r--r-- | minijava/TypeCheckSimp.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/minijava/TypeCheckSimp.java b/minijava/TypeCheckSimp.java index 57b6be9..8daa2b1 100644 --- a/minijava/TypeCheckSimp.java +++ b/minijava/TypeCheckSimp.java @@ -29,9 +29,6 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type Utilities.print_filter("", true); } - // - // Auto class visitors--probably don't need to be overridden. - // public TypeInstance visit(NodeList n, HashMap<String,TypeInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -112,6 +109,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type public TypeInstance visit(NodeToken n, HashMap<String,TypeInstance> argu) { // A fixed string token. '⌣' ++this.offset; + // Utilities.print_filter("Node " + n.toString(), true); // this.printNode(n, argu, false, null); --this.offset; return null; @@ -955,7 +953,8 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type ++this.offset; this.printNode(n, argu, true, null); - TypeInstance ret = argu.get(n.f0.tokenImage); + TypeInstance ret = (argu.get(n.f0.tokenImage) != null) ? + argu.get(n.f0.tokenImage) : new TypeInstance(null, TypeEnum.ERROR); this.printNode(n, argu, false, ret.get_type()); --this.offset; @@ -994,9 +993,9 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type this.printNode(n, argu, true, null); n.f0.accept(this, argu); - TypeInstance ret = n.f1.accept(this, argu); + n.f1.accept(this, argu); n.f2.accept(this, argu); - n.f3.accept(this, argu); + TypeInstance ret = n.f3.accept(this, argu); n.f4.accept(this, argu); ret = (ret.get_type() == TypeEnum.integer) ? new TypeInstance(null, TypeEnum.int_array) : new TypeInstance(null, TypeEnum.ERROR); |