Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs444
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Yang
cs444
Commits
8f2b5dcc
Commit
8f2b5dcc
authored
5 years ago
by
pycsham
Browse files
Options
Downloads
Patches
Plain Diff
changed issue with checking type for field access
parent
7ea527ab
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ExprPrimaryNodes.py
+4
-1
4 additions, 1 deletion
ExprPrimaryNodes.py
NameNode.py
+11
-0
11 additions, 0 deletions
NameNode.py
with
15 additions
and
1 deletion
ExprPrimaryNodes.py
+
4
−
1
View file @
8f2b5dcc
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
NameNode.py
+
11
−
0
View file @
8f2b5dcc
...
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment