Commit df6514ff authored by Stefan Behnel's avatar Stefan Behnel

cleanup

parent 5ae0cccf
......@@ -444,17 +444,24 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
else:
return node
new_node.value = new_node.constant_result = node.constant_result
new_node = new_node.coerce_to(node.type, self.module_scope)
new_node = new_node.coerce_to(node.type, self.current_scope)
return new_node
# in the future, other nodes can have their own handler method here
# that can replace them with a constant result node
def visit_ModuleNode(self, node):
self.module_scope = node.scope
self.current_scope = node.scope
self.visitchildren(node)
return node
def visit_FuncDefNode(self, node):
old_scope = self.current_scope
self.current_scope = node.entry.scope
self.visitchildren(node)
self.current_scope = old_scope
return node
def visit_Node(self, node):
self.visitchildren(node)
return node
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment