diff --git a/ExprPrimaryNodes.py b/ExprPrimaryNodes.py index ad49d8951bc803da99023e461e439c2a5f7c059b..1369ffd4d8ac508036b3d15bda13e0f168bdaa86 100644 --- a/ExprPrimaryNodes.py +++ b/ExprPrimaryNodes.py @@ -126,7 +126,7 @@ class ArrayAccessNode(ASTNode): if (parseTree.children[0].name == 'primaryNoArrayAccess'): self.array = makeNodeFromAllPrimary(parseTree.children[0], typeName) else: - self.array = NameNode(parseTree.children[0].children[0], False, typeName) + self.array = NameNode(parseTree.children[0], False, typeName) self.index = makeNodeFromExpr(parseTree.children[2], typeName) self.children.append(self.array) @@ -210,6 +210,19 @@ class AssignNode(ASTNode): self.right.disambigName() # helperDisambigName(self.right) # helperDisambigName(self.left) + + def checkType(self): + self.left.checkType() + self.right.checkType() + + if self.left.myType.assignable(self.right.myType): + self.myType = self.left.myType + return + print(self.left.myType.isArray) + print(self.right.myType.isArray) + print(self.left.name) + print(self.right) + raise Exception("ERROR: assignment operation failed. Cannot assign type {0} to type {1} at class {2}".format(self.left.myType.name, self.right.myType.name, self.typeName)) ##################################################################################