Commit 8710e415 authored by Stefan Behnel's avatar Stefan Behnel

undo CloneNode wrapping of the self-object when optimising method calls

parent 6bff7773
...@@ -4213,6 +4213,10 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin): ...@@ -4213,6 +4213,10 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin):
assignment.rhs and not isinstance(assignment.rhs, non_method_nodes) assignment.rhs and not isinstance(assignment.rhs, non_method_nodes)
for assignment in entry.cf_assignments) for assignment in entry.cf_assignments)
if may_be_a_method: if may_be_a_method:
if (node.self and function.is_attribute and
isinstance(function.obj, ExprNodes.CloneNode) and function.obj.arg is node.self):
# function self object was moved into a CloneNode => undo
function.obj = function.obj.arg
node = self.replace(node, ExprNodes.PyMethodCallNode.from_node( node = self.replace(node, ExprNodes.PyMethodCallNode.from_node(
node, function=function, arg_tuple=node.arg_tuple, type=node.type)) node, function=function, arg_tuple=node.arg_tuple, type=node.type))
return 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