diff options
Diffstat (limited to 'typecheck/library/TypeCheckSimp.java')
-rw-r--r-- | typecheck/library/TypeCheckSimp.java | 194 |
1 files changed, 99 insertions, 95 deletions
diff --git a/typecheck/library/TypeCheckSimp.java b/typecheck/library/TypeCheckSimp.java index b4844a1..3d262fd 100644 --- a/typecheck/library/TypeCheckSimp.java +++ b/typecheck/library/TypeCheckSimp.java @@ -2,34 +2,36 @@ package typecheck.library; import syntaxtree.*; import visitor.*; +import st.*; +import misc.*; import java.util.*; /** * Provides default methods which visit each node in the tree in depth-first * order. Your visitors may extend this class. */ -public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,TypeInstance>> { +public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,AbstractInstance>> { private int offset; - private void printNode(Node n, HashMap<String,TypeInstance> argu, boolean enter, TypeEnum consensus) { + private void printNode(Node n, HashMap<String,AbstractInstance> argu, boolean enter, TypeEnum consensus) { for (int i=0; i < this.offset; ++i) - Utilities.print_filter(".", false); + PrintFilter.print(".", false); if (enter) - Utilities.print_filter("Visiting ", false); + PrintFilter.print("Visiting ", false); else - Utilities.print_filter("Leaving ", false); - Utilities.print_filter(n.getClass().getSimpleName(), false); + PrintFilter.print("Leaving ", false); + PrintFilter.print(n.getClass().getSimpleName(), false); if (!enter) { if (consensus == TypeEnum.ERROR) - Utilities.print_filter(" did not type check.", false); + PrintFilter.print(" did not type check.", false); else - Utilities.print_filter(" found type " + consensus, false); + PrintFilter.print(" found type " + consensus, false); } - Utilities.print_filter("", true); + PrintFilter.print("", true); } - public TypeInstance visit(NodeList n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NodeList n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -48,7 +50,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type return ret; } - public TypeInstance visit(NodeListOptional n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NodeListOptional n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -72,7 +74,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type } // FIXME - public TypeInstance visit(NodeOptional n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NodeOptional n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -88,7 +90,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type return ret; } - public TypeInstance visit(NodeSequence n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NodeSequence n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -106,13 +108,13 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type return ret; } - public TypeInstance visit(NodeToken n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NodeToken n, HashMap<String,AbstractInstance> argu) { // A fixed string token. '⌣' for (int i=0; i < this.offset; ++i) - Utilities.print_filter(".", false); - Utilities.print_filter("Leaving " + n.getClass().getSimpleName() + - " => " + - n.toString(), true); + PrintFilter.print(".", false); + PrintFilter.print("Leaving " + n.getClass().getSimpleName() + + " => " + + n.toString(), true); return null; } @@ -125,7 +127,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> ( TypeDeclaration() )* * f2 -> <EOF> */ - public TypeInstance visit(Goal n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Goal n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -158,7 +160,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f16 -> "}" * f17 -> "}" */ - public TypeInstance visit(MainClass n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(MainClass n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -188,9 +190,9 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> ClassDeclaration() - * | ClassExtendsDeclaration() + * | ClassExtendsDeclaration() */ - public TypeInstance visit(TypeDeclaration n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(TypeDeclaration n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -209,7 +211,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f4 -> ( MethodDeclaration() )* * f5 -> "}" */ - public TypeInstance visit(ClassDeclaration n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ClassDeclaration n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -240,7 +242,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f6 -> ( MethodDeclaration() )* * f7 -> "}" */ - public TypeInstance visit(ClassExtendsDeclaration n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ClassExtendsDeclaration n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -269,7 +271,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> Identifier() * f2 -> ";" */ - public TypeInstance visit(VarDeclaration n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(VarDeclaration n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -298,7 +300,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f11 -> ";" * f12 -> "}" */ - public TypeInstance visit(MethodDeclaration n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(MethodDeclaration n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -315,7 +317,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type TypeInstance retur = n.f10.accept(this, argu); n.f11.accept(this, argu); n.f12.accept(this, argu); - TypeInstance ret = (stmt.equal_type(ret_type) && + TypeInstance ret = (stmt.same_type(ret_type) && stmt.has_checked()) ? new TypeInstance(null, TypeEnum.CHECK) : new TypeInstance(null, TypeEnum.ERROR); @@ -329,7 +331,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> FormalParameter() * f1 -> ( FormalParameterRest() )* */ - public TypeInstance visit(FormalParameterList n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(FormalParameterList n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -350,7 +352,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> Type() * f1 -> Identifier() */ - public TypeInstance visit(FormalParameter n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(FormalParameter n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -366,7 +368,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> "," * f1 -> FormalParameter() */ - public TypeInstance visit(FormalParameterRest n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(FormalParameterRest n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -380,15 +382,15 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> ArrayType() - * | BooleanType() - * | IntegerType() - * | Identifier() + * | BooleanType() + * | IntegerType() + * | Identifier() */ - public TypeInstance visit(Type n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Type n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); - TypeInstance ret = n.f0.accept(this, argu); + TypeInstance ret = n.f0.accept(this, argu); this.printNode(n, argu, false, ret.get_type()); --this.offset; @@ -400,11 +402,11 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "[" * f2 -> "]" */ - public TypeInstance visit(ArrayType n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ArrayType n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); - TypeInstance ret = new TypeInstance(null, TypeEnum.int_array); + TypeInstance ret = new TypeInstance(null, TypeEnum.intarray); this.printNode(n, argu, false, ret.get_type()); --this.offset; @@ -414,11 +416,11 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> "boolean" */ - public TypeInstance visit(BooleanType n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(BooleanType n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); - TypeInstance ret = new TypeInstance(null, TypeEnum.bool); + TypeInstance ret = new TypeInstance(null, TypeEnum.bool); this.printNode(n, argu, false, ret.get_type()); --this.offset; @@ -428,7 +430,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> "int" */ - public TypeInstance visit(IntegerType n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(IntegerType n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -441,13 +443,13 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> Block() - * | AssignmentStatement() - * | ArrayAssignmentStatement() - * | IfStatement() - * | WhileStatement() - * | PrintStatement() + * | AssignmentStatement() + * | ArrayAssignmentStatement() + * | IfStatement() + * | WhileStatement() + * | PrintStatement() */ - public TypeInstance visit(Statement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Statement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -463,7 +465,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> ( Statement() )* * f2 -> "}" */ - public TypeInstance visit(Block n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Block n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -486,7 +488,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f2 -> Expression() * f3 -> ";" */ - public TypeInstance visit(AssignmentStatement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(AssignmentStatement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -494,7 +496,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type n.f1.accept(this, argu); TypeInstance rhs = n.f2.accept(this, argu); n.f3.accept(this, argu); - TypeInstance ret = (lhs.equal_type(rhs)) ? + TypeInstance ret = (lhs.same_type(rhs)) ? new TypeInstance(null, TypeEnum.CHECK) : new TypeInstance(null, TypeEnum.ERROR); @@ -515,7 +517,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f5 -> Expression() * f6 -> ";" */ - public TypeInstance visit(ArrayAssignmentStatement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ArrayAssignmentStatement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -526,7 +528,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type n.f4.accept(this, argu); TypeInstance value = n.f5.accept(this, argu); n.f6.accept(this, argu); - TypeInstance ret = (id.get_type() == TypeEnum.int_array && + TypeInstance ret = (id.get_type() == TypeEnum.intarray && index.get_type() == TypeEnum.integer && value.get_type() == TypeEnum.integer) ? new TypeInstance(null, TypeEnum.CHECK) : @@ -548,7 +550,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f5 -> "else" * f6 -> Statement() */ - public TypeInstance visit(IfStatement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(IfStatement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -580,7 +582,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f3 -> ")" * f4 -> Statement() */ - public TypeInstance visit(WhileStatement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(WhileStatement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -608,7 +610,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f3 -> ")" * f4 -> ";" */ - public TypeInstance visit(PrintStatement n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(PrintStatement n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -628,16 +630,16 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> AndExpression() - * | CompareExpression() - * | PlusExpression() - * | MinusExpression() - * | TimesExpression() - * | ArrayLookup() - * | ArrayLength() - * | MessageSend() - * | PrimaryExpression() + * | CompareExpression() + * | PlusExpression() + * | MinusExpression() + * | TimesExpression() + * | ArrayLookup() + * | ArrayLength() + * | MessageSend() + * | PrimaryExpression() */ - public TypeInstance visit(Expression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Expression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -655,7 +657,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "&&" * f2 -> PrimaryExpression() */ - public TypeInstance visit(AndExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(AndExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -679,7 +681,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "<" * f2 -> PrimaryExpression() */ - public TypeInstance visit(CompareExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(CompareExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -703,7 +705,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "+" * f2 -> PrimaryExpression() */ - public TypeInstance visit(PlusExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(PlusExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -727,7 +729,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "-" * f2 -> PrimaryExpression() */ - public TypeInstance visit(MinusExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(MinusExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -751,7 +753,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "*" * f2 -> PrimaryExpression() */ - public TypeInstance visit(TimesExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(TimesExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -777,7 +779,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f2 -> PrimaryExpression() * f3 -> "]" */ - public TypeInstance visit(ArrayLookup n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ArrayLookup n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -785,7 +787,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type n.f1.accept(this, argu); TypeInstance index = n.f2.accept(this, argu); n.f3.accept(this, argu); - TypeInstance ret = (array.get_type() == TypeEnum.int_array && + TypeInstance ret = (array.get_type() == TypeEnum.intarray && index.get_type() == TypeEnum.integer) ? new TypeInstance(null, TypeEnum.integer) : new TypeInstance(null, TypeEnum.ERROR); @@ -802,14 +804,14 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> "." * f2 -> "length" */ - public TypeInstance visit(ArrayLength n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ArrayLength n, HashMap<String,AbstractInstance> argu) { ++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(null, TypeEnum.integer) : + ret = (ret.get_type() == TypeEnum.intarray) ? new TypeInstance(null, TypeEnum.integer) : new TypeInstance(null, TypeEnum.ERROR); this.printNode(n, argu, false, ret.get_type()); @@ -828,7 +830,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f4 -> ( ExpressionList() )? * f5 -> ")" */ - public TypeInstance visit(MessageSend n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(MessageSend n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -847,7 +849,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> Expression() * f1 -> ( ExpressionRest() )* */ - public TypeInstance visit(ExpressionList n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ExpressionList n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -867,7 +869,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> "," * f1 -> Expression() */ - public TypeInstance visit(ExpressionRest n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ExpressionRest n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -881,16 +883,16 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type /** * f0 -> IntegerLiteral() - * | TrueLiteral() - * | FalseLiteral() - * | Identifier() - * | ThisExpression() - * | ArrayAllocationExpression() - * | AllocationExpression() - * | NotExpression() - * | BracketExpression() + * | TrueLiteral() + * | FalseLiteral() + * | Identifier() + * | ThisExpression() + * | ArrayAllocationExpression() + * | AllocationExpression() + * | NotExpression() + * | BracketExpression() */ - public TypeInstance visit(PrimaryExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(PrimaryExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -907,7 +909,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * * f0 -> <INTEGER_LITERAL> */ - public TypeInstance visit(IntegerLiteral n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(IntegerLiteral n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -921,7 +923,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * * f0 -> "true" */ - public TypeInstance visit(TrueLiteral n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(TrueLiteral n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -935,7 +937,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * * f0 -> "false" */ - public TypeInstance visit(FalseLiteral n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(FalseLiteral n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -950,12 +952,14 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * * f0 -> <IDENTIFIER> */ - public TypeInstance visit(Identifier n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(Identifier n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); TypeInstance ret = (argu.get(n.f0.tokenImage) != null) ? - argu.get(n.f0.tokenImage) : new TypeInstance(null, TypeEnum.ERROR); + new TypeInstance(argu.get(n.f0.tokenImage).get_name(), + argu.get(n.f0.tokenImage).get_type()) : + new TypeInstance(null, TypeEnum.ERROR); this.printNode(n, argu, false, ret.get_type()); --this.offset; @@ -968,7 +972,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * * f0 -> "this" */ - public TypeInstance visit(ThisExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ThisExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -989,7 +993,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f3 -> Expression() * f4 -> "]" */ - public TypeInstance visit(ArrayAllocationExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(ArrayAllocationExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -998,7 +1002,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type n.f2.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) : + ret = (ret.get_type() == TypeEnum.integer) ? new TypeInstance(null, TypeEnum.intarray) : new TypeInstance(null, TypeEnum.ERROR); this.printNode(n, argu, false, ret.get_type()); @@ -1015,7 +1019,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f2 -> "(" * f3 -> ")" */ - public TypeInstance visit(AllocationExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(AllocationExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -1035,7 +1039,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f0 -> "!" * f1 -> Expression() */ - public TypeInstance visit(NotExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(NotExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); @@ -1054,7 +1058,7 @@ public class TypeCheckSimp implements GJVisitor<TypeInstance,HashMap<String,Type * f1 -> Expression() * f2 -> ")" */ - public TypeInstance visit(BracketExpression n, HashMap<String,TypeInstance> argu) { + public TypeInstance visit(BracketExpression n, HashMap<String,AbstractInstance> argu) { ++this.offset; this.printNode(n, argu, true, null); |