drop redundant code in ExpandInplaceOperators transform
authorStefan Behnel <scoder@users.berlios.de>
Fri, 12 Nov 2010 10:35:35 +0000 (11:35 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 12 Nov 2010 10:35:35 +0000 (11:35 +0100)
Cython/Compiler/ParseTreeTransforms.py

index bb2f0f27c43c935d5c1aba99dd4cef96af149470..59023063d86c6ed6ab6629dca8c3339636f4f6e6 100644 (file)
@@ -1195,17 +1195,7 @@ class AnalyseExpressionsTransform(CythonTransform):
         self.visitchildren(node)
         return node
 
-class ExpandInplaceOperators(CythonTransform):
-
-    def __call__(self, root):
-        self.env_stack = [root.scope]
-        return super(ExpandInplaceOperators, self).__call__(root)
-
-    def visit_FuncDefNode(self, node):
-        self.env_stack.append(node.local_scope)
-        self.visitchildren(node)
-        self.env_stack.pop()
-        return node
+class ExpandInplaceOperators(EnvTransform):
     
     def visit_InPlaceAssignmentNode(self, node):
         lhs = node.lhs
@@ -1250,16 +1240,13 @@ class ExpandInplaceOperators(CythonTransform):
         let_ref_nodes.reverse()
         for t in let_ref_nodes:
             node = LetNode(t, node)
-        node.analyse_expressions(self.env_stack[-1])
+        node.analyse_expressions(self.current_env())
         return node
 
     def visit_ExprNode(self, node):
         # In-place assignments can't happen within an expression.
         return node
 
-    def visit_Node(self, node):
-        self.visitchildren(node)
-        return node
 
 class AlignFunctionDefinitions(CythonTransform):
     """