Skip to content
Snippets Groups Projects

New new string

Merged Xun Yang requested to merge new-new-string into master
1 file
+ 19
9
Compare changes
  • Side-by-side
  • Inline
+ 19
9
@@ -357,14 +357,24 @@ def getNameNodes(node):
@@ -357,14 +357,24 @@ def getNameNodes(node):
# Output: A list of local var dcl to be pushed onto the stack
# Output: A list of local var dcl to be pushed onto the stack
def getVarDclNodes(node):
def getVarDclNodes(node):
result = []
result = []
for s in node.statements:
if s.__class__.__name__ == 'VarDclNode':
if node.__class__.__name__ == 'VarDclNode':
result += [s]
return [node]
elif node.__class__.__name__ == 'BlockNode':
if s.__class__.__name__ == 'BlockNode':
for s in node.statements:
result += getVarDclNodes(node)
if s.__class__.__name__ == 'VarDclNode':
result += [s]
if s.__class__.__name__ == 'ForNode' and s.forInit:
result += [s.forInit]
if s.__class__.__name__ == 'BlockNode':
 
result += getVarDclNodes(node)
 
 
if s.__class__.__name__ == 'ForNode':
 
if s.forInit:
 
result += [s.forInit]
 
if s.bodyStatement:
 
result += getVarDclNodes(s.bodyStatement)
 
 
if s.__class__.__name__ =='WhileNode' and s.whileBody:
 
result += getVarDclNodes(s.whileBody)
return result
return result
Loading