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
528fced2
Commit
528fced2
authored
5 years ago
by
Xun Yang
Browse files
Options
Downloads
Patches
Plain Diff
cast null
parent
4f1d914a
No related branches found
No related tags found
2 merge requests
!30
New new string
,
!20
Master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ExprPrimaryNodes.py
+2
-2
2 additions, 2 deletions
ExprPrimaryNodes.py
TheTypeNode.py
+1
-1
1 addition, 1 deletion
TheTypeNode.py
with
3 additions
and
3 deletions
ExprPrimaryNodes.py
+
2
−
2
View file @
528fced2
...
@@ -426,7 +426,7 @@ class CastNode(ASTNode):
...
@@ -426,7 +426,7 @@ class CastNode(ASTNode):
# only test if not primitive
# only test if not primitive
if
self
.
right
.
myType
.
isArray
==
self
.
left
.
myType
.
isArray
:
if
self
.
right
.
myType
.
isArray
==
self
.
left
.
myType
.
isArray
:
if
(
not
self
.
lef
t
.
myType
.
isPrimitive
):
if
(
not
self
.
righ
t
.
myType
.
isPrimitive
):
# cast would've exception if array is casting to non-array and not Object
# cast would've exception if array is casting to non-array and not Object
offset
=
self
.
left
.
myType
.
typePointer
.
subTypeOffset
offset
=
self
.
left
.
myType
.
typePointer
.
subTypeOffset
self
.
code
+=
p
(
"
mov
"
,
"
ebx
"
,
"
[eax]
"
,
"
start subtype test
"
)
# access class tag of left object
self
.
code
+=
p
(
"
mov
"
,
"
ebx
"
,
"
[eax]
"
,
"
start subtype test
"
)
# access class tag of left object
...
@@ -703,7 +703,7 @@ class ExprNode(ASTNode):
...
@@ -703,7 +703,7 @@ class ExprNode(ASTNode):
# only test if non-primitive, both arrays or both non arrays
# only test if non-primitive, both arrays or both non arrays
if
self
.
right
.
myType
.
isArray
==
self
.
left
.
myType
.
isArray
:
if
self
.
right
.
myType
.
isArray
==
self
.
left
.
myType
.
isArray
:
if
not
self
.
righ
t
.
myType
.
isPrimitive
:
if
not
self
.
lef
t
.
myType
.
isPrimitive
:
offset
=
self
.
right
.
myType
.
typePointer
.
subTypeOffset
offset
=
self
.
right
.
myType
.
typePointer
.
subTypeOffset
self
.
code
+=
p
(
"
mov
"
,
"
eax
"
,
"
[eax]
"
)
# access class tag of left object
self
.
code
+=
p
(
"
mov
"
,
"
eax
"
,
"
[eax]
"
)
# access class tag of left object
self
.
code
+=
p
(
"
mov
"
,
"
eax
"
,
"
[eax + 4]
"
)
# access subtype testing column
self
.
code
+=
p
(
"
mov
"
,
"
eax
"
,
"
[eax + 4]
"
)
# access subtype testing column
...
...
This diff is collapsed.
Click to expand it.
TheTypeNode.py
+
1
−
1
View file @
528fced2
...
@@ -41,7 +41,7 @@ class TypeStruct():
...
@@ -41,7 +41,7 @@ class TypeStruct():
self
.
isPrimitive
=
False
self
.
isPrimitive
=
False
self
.
typePointer
=
typePointer
self
.
typePointer
=
typePointer
self
.
name
=
name
self
.
name
=
name
if
name
in
[
'
boolean
'
,
'
byte
'
,
'
char
'
,
'
int
'
,
'
short
'
,
'
void
'
]:
if
name
in
[
'
boolean
'
,
'
byte
'
,
'
char
'
,
'
int
'
,
'
short
'
,
'
void
'
,
'
null
'
]:
self
.
isPrimitive
=
True
self
.
isPrimitive
=
True
def
link
(
self
,
env
):
def
link
(
self
,
env
):
...
...
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