From 7a26f1108fb412daa4495628fc5136da2bb0ee34 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Mon, 18 Mar 2024 16:49:21 -0600 Subject: Comments containing information on is done/needs to be done --- minijava/TypeCheckSimp.java | 599 ++++++++++++++++++++++++-------------------- 1 file changed, 328 insertions(+), 271 deletions(-) (limited to 'minijava/TypeCheckSimp.java') diff --git a/minijava/TypeCheckSimp.java b/minijava/TypeCheckSimp.java index ab5d8c9..f9e71bd 100644 --- a/minijava/TypeCheckSimp.java +++ b/minijava/TypeCheckSimp.java @@ -13,29 +13,29 @@ public class TypeCheckSimp implements GJVisitor argu, boolean enter, TypeEnum consensus) { - for (int i=0; i < this.offset; ++i) + for (int i=0; i < this.offset; ++i) System.out.print("."); - if (enter) + if (enter) System.out.print("Visiting "); else System.out.print("Leaving "); System.out.print(n.getClass().getSimpleName()); - if (!enter) { - if (consensus == TypeEnum.ERROR) - System.out.print(" did not type check."); - else - System.out.print(" found type " + consensus); - } - System.out.println(); + if (!enter) { + if (consensus == TypeEnum.ERROR) + System.out.print(" did not type check."); + else + System.out.print(" found type " + consensus); + } + System.out.println(); } // // Auto class visitors--probably don't need to be overridden. // public TypeInstance visit(NodeList n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = new TypeInstance(TypeEnum.CHECK); int _count=0; for ( Enumeration e = n.elements(); e.hasMoreElements(); ) { @@ -45,17 +45,17 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - - TypeInstance ret; + ++this.offset; + this.printNode(n, argu, true, null); + + TypeInstance ret; if ( n.present() ) { // FIXME "present" seems to check if any nodes exist at all! ret = new TypeInstance(TypeEnum.CHECK); int _count=0; @@ -68,33 +68,33 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); + ++this.offset; + this.printNode(n, argu, true, null); + + TypeInstance ret; - TypeInstance ret; - if ( n.present() ) ret = n.node.accept(this,argu); else ret = new TypeInstance(TypeEnum.CHECK); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; - return ret; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; + return ret; } public TypeInstance visit(NodeSequence n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = new TypeInstance(TypeEnum.CHECK); int _count=0; for ( Enumeration e = n.elements(); e.hasMoreElements(); ) { @@ -104,16 +104,16 @@ public class TypeCheckSimp implements GJVisitor argu) { - // A fixed string token. '⌣' - ++this.offset; - // this.printNode(n, argu, false, null); - --this.offset; + // A fixed string token. '⌣' + ++this.offset; + // this.printNode(n, argu, false, null); + --this.offset; return null; } @@ -127,15 +127,15 @@ public class TypeCheckSimp implements GJVisitor */ public TypeInstance visit(Goal n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); n.f1.accept(this, argu); n.f2.accept(this, argu); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -160,9 +160,9 @@ public class TypeCheckSimp implements GJVisitor "}" */ public TypeInstance visit(MainClass n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance name = n.f1.accept(this, argu); n.f2.accept(this, argu); @@ -182,8 +182,8 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -211,9 +211,9 @@ public class TypeCheckSimp implements GJVisitor "}" */ public TypeInstance visit(ClassDeclaration n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance _ret=null; n.f0.accept(this, argu); n.f1.accept(this, argu); @@ -221,7 +221,7 @@ public class TypeCheckSimp implements GJVisitor "}" */ public TypeInstance visit(ClassExtendsDeclaration n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance _ret=null; n.f0.accept(this, argu); n.f1.accept(this, argu); @@ -248,7 +248,7 @@ public class TypeCheckSimp implements GJVisitor ";" */ public TypeInstance visit(VarDeclaration n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); n.f1.accept(this, argu); n.f2.accept(this, argu); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -288,9 +288,9 @@ public class TypeCheckSimp implements GJVisitor "}" */ public TypeInstance visit(MethodDeclaration n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret_type = n.f1.accept(this, argu); n.f2.accept(this, argu); @@ -304,13 +304,13 @@ public class TypeCheckSimp implements GJVisitor ( FormalParameterRest() )* */ public TypeInstance visit(FormalParameterList n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance _ret=null; TypeInstance para1 = n.f0.accept(this, argu); TypeInstance parar = n.f1.accept(this, argu); TypeInstance ret = (para1.get_type() == TypeEnum.CHECK && - parar.get_type() == TypeEnum.CHECK) ? - new TypeInstance(TypeEnum.CHECK) : - new TypeInstance(TypeEnum.ERROR); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + parar.get_type() == TypeEnum.CHECK) ? + new TypeInstance(TypeEnum.CHECK) : + new TypeInstance(TypeEnum.ERROR); + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -340,14 +340,14 @@ public class TypeCheckSimp implements GJVisitor Identifier() */ public TypeInstance visit(FormalParameter n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); n.f1.accept(this, argu); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -356,14 +356,14 @@ public class TypeCheckSimp implements GJVisitor FormalParameter() */ public TypeInstance visit(FormalParameterRest n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } @@ -374,13 +374,13 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - - TypeInstance ret = n.f0.accept(this, argu); - + ++this.offset; + this.printNode(n, argu, true, null); + + TypeInstance ret = n.f0.accept(this, argu); + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -390,16 +390,13 @@ public class TypeCheckSimp implements GJVisitor "]" */ public TypeInstance visit(ArrayType n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - - n.f0.accept(this, argu); - n.f1.accept(this, argu); - n.f2.accept(this, argu); + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = new TypeInstance(TypeEnum.int_array); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -407,12 +404,13 @@ public class TypeCheckSimp implements GJVisitor "boolean" */ public TypeInstance visit(BooleanType n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = new TypeInstance(TypeEnum.bool); + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -420,13 +418,13 @@ public class TypeCheckSimp implements GJVisitor "int" */ public TypeInstance visit(IntegerType n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = new TypeInstance(TypeEnum.integer); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -439,13 +437,13 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -455,28 +453,32 @@ public class TypeCheckSimp implements GJVisitor "}" */ public TypeInstance visit(Block n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); n.f2.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } + // FIXME FIXME FIXME + // Given we only have a few types, what is a subtype of what? /** + * [23]: Expression is a subtype of identifier, and e typechecks* + * * f0 -> Identifier() * f1 -> "=" * f2 -> Expression() * f3 -> ";" */ public TypeInstance visit(AssignmentStatement n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance lhs = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance rhs = n.f2.accept(this, argu); @@ -484,25 +486,29 @@ public class TypeCheckSimp implements GJVisitor Identifier() * f1 -> "[" - * f2 -> Expression() //int + * f2 -> Expression() * f3 -> "]" * f4 -> "=" - * f5 -> Expression() //int + * f5 -> Expression() * f6 -> ";" */ public TypeInstance visit(ArrayAssignmentStatement n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + + TypeInstance id = new TypeInstance(argu.get(n.f0.f0.tokenImage)); n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance index = n.f2.accept(this, argu); @@ -510,17 +516,20 @@ public class TypeCheckSimp implements GJVisitor "if" * f1 -> "(" * f2 -> Expression() @@ -530,9 +539,9 @@ public class TypeCheckSimp implements GJVisitor Statement() */ public TypeInstance visit(IfStatement n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance expr = n.f2.accept(this, argu); @@ -545,14 +554,16 @@ public class TypeCheckSimp implements GJVisitor "while" * f1 -> "(" * f2 -> Expression() @@ -560,9 +571,9 @@ public class TypeCheckSimp implements GJVisitor Statement() */ public TypeInstance visit(WhileStatement n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance expr = n.f2.accept(this, argu); @@ -572,13 +583,15 @@ public class TypeCheckSimp implements GJVisitor "System.out.println" * f1 -> "(" * f2 -> Expression() @@ -586,9 +599,9 @@ public class TypeCheckSimp implements GJVisitor ";" */ public TypeInstance visit(PrintStatement n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance ret = n.f2.accept(this, argu); @@ -597,9 +610,9 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } /** - * f0 -> PrimaryExpressionppp() + * DONE [28]: If expressions are both booleans, return is a boolean + * + * f0 -> PrimaryExpression() * f1 -> "&&" * f2 -> PrimaryExpression() */ public TypeInstance visit(AndExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance oper1 = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance oper2 = n.f2.accept(this, argu); @@ -641,21 +656,23 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "<" * f2 -> PrimaryExpression() */ public TypeInstance visit(CompareExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance oper1 = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance oper2 = n.f2.accept(this, argu); @@ -663,21 +680,23 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "+" * f2 -> PrimaryExpression() */ public TypeInstance visit(PlusExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance oper1 = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance oper2 = n.f2.accept(this, argu); @@ -685,21 +704,23 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "-" * f2 -> PrimaryExpression() */ public TypeInstance visit(MinusExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance oper1 = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance oper2 = n.f2.accept(this, argu); @@ -707,21 +728,23 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "*" * f2 -> PrimaryExpression() */ public TypeInstance visit(TimesExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance oper1 = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance oper2 = n.f2.accept(this, argu); @@ -729,22 +752,25 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "[" * f2 -> PrimaryExpression() * f3 -> "]" */ public TypeInstance visit(ArrayLookup n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance array = n.f0.accept(this, argu); n.f1.accept(this, argu); TypeInstance index = n.f2.accept(this, argu); @@ -753,33 +779,38 @@ public class TypeCheckSimp implements GJVisitor PrimaryExpression() * f1 -> "." * f2 -> "length" */ public TypeInstance visit(ArrayLength n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); n.f1.accept(this, argu); n.f2.accept(this, argu); ret = (ret.get_type() == TypeEnum.int_array) ? new TypeInstance(TypeEnum.integer) : new TypeInstance(TypeEnum.ERROR); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } + // FIXME FIXME FIXME /** + * [35]: + * * f0 -> PrimaryExpression() * f1 -> "." * f2 -> Identifier() @@ -788,9 +819,9 @@ public class TypeCheckSimp implements GJVisitor ")" */ public TypeInstance visit(MessageSend n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance _ret=null; n.f0.accept(this, argu); n.f1.accept(this, argu); @@ -798,7 +829,7 @@ public class TypeCheckSimp implements GJVisitor ( ExpressionRest() )* */ public TypeInstance visit(ExpressionList n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - - TypeInstance _ret=null; + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance expr1 = n.f0.accept(this, argu); TypeInstance exprr = n.f1.accept(this, argu); - --this.offset; - return _ret; + TypeInstance ret = (expr1.get_type() == TypeEnum.CHECK && + exprr.get_type() == TypeEnum.CHECK) ? + new TypeInstance(TypeEnum.CHECK) : + new TypeInstance(TypeEnum.ERROR); + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; + return ret; } /** @@ -823,14 +859,14 @@ public class TypeCheckSimp implements GJVisitor Expression() */ public TypeInstance visit(ExpressionRest n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } @@ -846,83 +882,97 @@ public class TypeCheckSimp implements GJVisitor argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + TypeInstance ret = n.f0.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } /** + * DONE [36]: return is an int + * + * * f0 -> */ public TypeInstance visit(IntegerLiteral n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + this.printNode(n, argu, false, TypeEnum.integer); - --this.offset; + --this.offset; return new TypeInstance(TypeEnum.integer); } /** + * DONE [37]: return is a bool + * * f0 -> "true" */ public TypeInstance visit(TrueLiteral n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + this.printNode(n, argu, false, TypeEnum.bool); - --this.offset; + --this.offset; return new TypeInstance(TypeEnum.bool); } /** + * DONE [38]: return is a bool + * * f0 -> "false" */ public TypeInstance visit(FalseLiteral n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + this.printNode(n, argu, false, TypeEnum.bool); - --this.offset; + --this.offset; return new TypeInstance(TypeEnum.bool); } + // FIXME /** + * [39]: id is a symbol in the current domain, return is id's type + * * f0 -> */ public TypeInstance visit(Identifier n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); + ++this.offset; + this.printNode(n, argu, true, null); + + TypeInstance ret = new TypeInstance(argu.get(n.f0.tokenImage)); - TypeInstance ret = new TypeInstance(argu.get(n.f0.tokenImage)); - - this.printNode(n, argu, false, TypeEnum.CHECK); - --this.offset; - return new TypeInstance(TypeEnum.CHECK); + this.printNode(n, argu, false, ret.get_type()); + --this.offset; + return ret; } - //FIXME + //FIXME FIXME FIXME /** + * [40]: method exists? but where is the token? + * * f0 -> "this" */ public TypeInstance visit(ThisExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); - TypeInstance ret = new TypeInstance(TypeEnum.CHECK); - - this.printNode(n, argu, false, ret.get_type()); - --this.offset; + TypeInstance ret = new TypeInstance(TypeEnum.CHECK); + + this.printNode(n, argu, false, ret.get_type()); + --this.offset; return ret; } /** + * DONE [41]: if expression is an integer, return is an int array + * * f0 -> "new" * f1 -> "int" * f2 -> "[" @@ -930,9 +980,9 @@ public class TypeCheckSimp implements GJVisitor "]" */ public TypeInstance visit(ArrayAllocationExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); n.f2.accept(this, argu); @@ -940,63 +990,70 @@ public class TypeCheckSimp implements GJVisitor "new" * f1 -> Identifier() * f2 -> "(" * f3 -> ")" */ public TypeInstance visit(AllocationExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); n.f2.accept(this, argu); n.f3.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } /** + * [43]: if expression is a boolean, return is a boolean + * * f0 -> "!" * f1 -> Expression() */ public TypeInstance visit(NotExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return (ret.get_type() == TypeEnum.bool) ? ret : new TypeInstance(TypeEnum.ERROR); } /** + * [44]: if e is a type, return is that same type + * * f0 -> "(" * f1 -> Expression() * f2 -> ")" */ public TypeInstance visit(BracketExpression n, HashMap argu) { - ++this.offset; - this.printNode(n, argu, true, null); - + ++this.offset; + this.printNode(n, argu, true, null); + n.f0.accept(this, argu); TypeInstance ret = n.f1.accept(this, argu); n.f2.accept(this, argu); - + this.printNode(n, argu, false, ret.get_type()); - --this.offset; + --this.offset; return ret; } -- cgit v1.2.3