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
a07f6098
Commit
a07f6098
authored
5 years ago
by
pycsham
Browse files
Options
Downloads
Patches
Plain Diff
fixed some funtion return bugs left over from A3. Passing 58/61 locally
parent
cd7407ce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MemberNodes.py
+3
-2
3 additions, 2 deletions
MemberNodes.py
with
3 additions
and
2 deletions
MemberNodes.py
+
3
−
2
View file @
a07f6098
...
...
@@ -69,6 +69,7 @@ class MethodNode(ASTNode):
self
.
children
=
[]
self
.
typeName
=
typeName
self
.
order
=
order
self
.
myType
=
None
# get method name
nameNodes
=
getParseTreeNodes
([
'
ID
'
],
parseTree
,
[
'
params
'
,
'
type
'
,
'
methodBody
'
])
...
...
@@ -160,12 +161,12 @@ class MethodNode(ASTNode):
for
n
in
returnNodes
:
# Checking for functions of type void
# Only valid if either the function doesn't have a return statement(checked above), or the return statement is a semicolon (return;)
if
self
.
myType
.
name
==
"
void
"
:
if
self
.
myType
and
self
.
myType
.
name
==
"
void
"
:
if
n
.
myType
:
raise
Exception
(
"
ERROR: return type of function {} doesn
'
t match with return statement.
"
.
format
(
self
.
name
))
return
# Checking for non void cases
if
not
self
.
myType
.
assignable
(
n
.
myType
):
if
self
.
myType
and
not
self
.
myType
.
assignable
(
n
.
myType
):
raise
Exception
(
"
ERROR: return type of function {} doesn
'
t match with return statement.
"
.
format
(
self
.
name
))
return
...
...
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