Commit 5a11f500 authored by Stefan Behnel's avatar Stefan Behnel

drop redundant code in ExpandInplaceOperators transform

parent b8e2b990
...@@ -1195,17 +1195,7 @@ class AnalyseExpressionsTransform(CythonTransform): ...@@ -1195,17 +1195,7 @@ class AnalyseExpressionsTransform(CythonTransform):
self.visitchildren(node) self.visitchildren(node)
return node return node
class ExpandInplaceOperators(CythonTransform): class ExpandInplaceOperators(EnvTransform):
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
def visit_InPlaceAssignmentNode(self, node): def visit_InPlaceAssignmentNode(self, node):
lhs = node.lhs lhs = node.lhs
...@@ -1250,16 +1240,13 @@ class ExpandInplaceOperators(CythonTransform): ...@@ -1250,16 +1240,13 @@ class ExpandInplaceOperators(CythonTransform):
let_ref_nodes.reverse() let_ref_nodes.reverse()
for t in let_ref_nodes: for t in let_ref_nodes:
node = LetNode(t, node) node = LetNode(t, node)
node.analyse_expressions(self.env_stack[-1]) node.analyse_expressions(self.current_env())
return node return node
def visit_ExprNode(self, node): def visit_ExprNode(self, node):
# In-place assignments can't happen within an expression. # In-place assignments can't happen within an expression.
return node return node
def visit_Node(self, node):
self.visitchildren(node)
return node
class AlignFunctionDefinitions(CythonTransform): class AlignFunctionDefinitions(CythonTransform):
""" """
......
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