From: Stefan Behnel Date: Sun, 14 Dec 2008 14:17:54 +0000 (+0100) Subject: cleanup X-Git-Tag: 0.11-beta~128 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=df6514ff43e5954601d7c12384fa767d3a9b2cb0;p=cython.git cleanup --- 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