Skip to content
Snippets Groups Projects
Commit b93dded8 authored by pycsham's avatar pycsham
Browse files

fixed a minor issue with ASTbuilding at the assign node. added call for A3 function in joosc.py

parent b5db74dc
No related branches found
No related tags found
No related merge requests found
......@@ -194,11 +194,11 @@ class AssignNode(ASTNode):
self.env = None
self.children = []
self.typeName = typeName # the type (class/interface) this node belongs under
if parseTree.children[0].name == 'fieldAccess':
self.left = FieldAccessNode(parseTree.children[0], typeName)
elif parseTree.children[0].name == 'arrayAccess':
self.left = ArrayAccessNode(parseTree.children[0], typeName)
if parseTree.children[0].children[0].name == 'fieldAccess':
self.left = FieldAccessNode(parseTree.children[0].children[0], typeName)
elif parseTree.children[0].children[0].name == 'arrayAccess':
self.left = ArrayAccessNode(parseTree.children[0].children[0], typeName)
else:
self.left = NameNode(parseTree.children[0].children[0], False, typeName)
......@@ -218,10 +218,7 @@ class AssignNode(ASTNode):
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))
......
......@@ -5,7 +5,7 @@ from os.path import isfile, join
from Scanning import scan
from Parsing import parse
from AstBuilding import astBuild, buildEnvAndLink
from AstBuilding import astBuild, buildEnvAndLink, disamiguateAndTypeChecking
import Weeding
......@@ -52,7 +52,15 @@ def main():
except Exception as e:
return 42 # double local variable declarations
try:
disamiguateAndTypeChecking(ASTs)
except Exception as e:
print(e)
return 42
return 0
re = main()
print(re)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment