raiseException("ERROR: Incompatible types. Left of {} type can't be used with right of {} type on operation {}".format(self.left.myType.name,self.right.myType.name,self.op))
...
...
@@ -701,6 +750,20 @@ class ExprNode(ASTNode):
# String Add TODO
if (self.left.myType.name=='java.lang.String'orself.right.myType.name=='java.lang.String') \
andself.op=='+':
# String.valueOf(left)
# if not hasattr(self.valueOfMethodInvLeft, "code"):
# self.valueOfMethodInvLeft.codeGen()
# self.code += self.valueOfMethodInvLeft.code
# String.valueOf(right)
# if not hasattr(self.valueOfMethodInvLeft, "code"):
# self.valueOfMethodInvLeft.codeGen()
# self.code += self.valueOfMethodInvLeft.code
# ( String.valueOf(right) ).concat( left )
ifnothasattr(self.concatMethodInv,"code"):
self.concatMethodInv.codeGen()
self.code+=self.concatMethodInv.code
return
# Number Add, Subtract, Multiply
ifself.opin['+','-','*']:
...
...
@@ -928,7 +991,7 @@ class FieldAccessNode(ASTNode):
# methodInvoc
classMethodInvNode(ASTNode):
# always list all fields in the init method to show the class structure