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
Merge requests
!30
New new string
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New new string
new-new-string
into
master
Overview
0
Commits
37
Pipelines
0
Changes
1
Merged
Xun Yang
requested to merge
new-new-string
into
master
5 years ago
Overview
0
Commits
37
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
e6508904
Prev
Next
Show latest version
1 file
+
7
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
e6508904
eval assign left to right
· e6508904
Xun Yang
authored
5 years ago
ExprPrimaryNodes.py
+
7
−
6
Options
@@ -333,16 +333,13 @@ class AssignNode(ASTNode):
def
codeGen
(
self
):
self
.
code
=
""
self
.
code
+=
(
"
; Evaluate right of assignment
\n
"
)
self
.
right
.
codeGen
()
self
.
code
=
self
.
right
.
code
self
.
code
+=
p
(
"
push
"
,
"
eax
"
)
# array assign check
if
self
.
left
.
__class__
.
__name__
==
"
ArrayAccessNode
"
and
(
not
self
.
left
.
myType
.
isPrimitive
):
self
.
code
+=
"
; array assign subtype check
\n
"
self
.
left
.
array
.
codeGen
()
self
.
code
+=
self
.
left
.
array
.
code
self
.
code
+=
p
(
"
push
"
,
"
eax
"
)
offset
=
self
.
right
.
myType
.
typePointer
.
subTypeOffset
self
.
code
+=
p
(
"
mov
"
,
"
ebx
"
,
"
[eax]
"
,
"
start subtype test
"
)
# access class tag of left object
@@ -355,10 +352,14 @@ class AssignNode(ASTNode):
self
.
code
+=
(
"
; Evaluate left of assignment
\n
"
)
self
.
code
+=
self
.
left
.
addr
()
self
.
code
+=
p
(
"
push
"
,
"
eax
"
)
self
.
code
+=
(
"
; Evaluate right of assignment
\n
"
)
self
.
right
.
codeGen
()
self
.
code
+=
self
.
right
.
code
self
.
code
+=
p
(
"
pop
"
,
"
ebx
"
)
self
.
code
+=
p
(
"
mov
"
,
"
[eax]
"
,
"
ebx
"
)
self
.
code
+=
p
(
"
mov
"
,
"
eax
"
,
"
ebx
"
)
# result of assignment is its own value
self
.
code
+=
p
(
"
mov
"
,
"
[ebx]
"
,
"
eax
"
)
self
.
code
+=
(
"
; End of assignment
\n
"
)
Loading