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

changed issue with checking type for field access

parent 7ea527ab
No related branches found
No related tags found
No related merge requests found
......@@ -421,7 +421,10 @@ class FieldAccessNode(ASTNode):
def checkType(self):
self.primary.checkType()
self.ID.prefixLink = self.primary.myType.typePointer
if self.primary.myType.isArray or self.primary.myType.isPrimitive:
self.ID.prefixLink = self.primary
else:
self.ID.prefixLink = self.primary.myType.typePointer
self.ID.checkType()
self.myType = self.ID.myType
......
......@@ -65,6 +65,13 @@ class NameNode(ASTNode):
self.addToPrefix(typeNode)
return True
return False
def checkLength(self):
if not self.IDs:
return True
if self.IDs[0] == "length":
return True
return False
# Checks and updates prefix if the next ID in self.IDs is a local variable or a parameter
def checkLocalVar(self):
......@@ -164,6 +171,10 @@ class NameNode(ASTNode):
# Checking if a1 is "this"
if self.checkThis():
return
# Checking if a1 is length
if self.checkLength():
return
# Checking if a1 is a local variable
if self.checkLocalVar():
......
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