From df6514ff43e5954601d7c12384fa767d3a9b2cb0 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 14 Dec 2008 15:17:54 +0100 Subject: [PATCH] cleanup --- Cython/Compiler/Optimize.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index d985ced0..df97cd3e 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -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 -- 2.26.2