Commit 86a65e40 authored by gsamain's avatar gsamain Committed by Xavier Thompson

Make cypclass use temporaries

parent c8ecf45e
......@@ -5899,6 +5899,10 @@ class SimpleCallNode(CallNode):
if i > 0: # first argument doesn't matter
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
elif arg.type.is_cyp_class:
if i > 0:
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
args[i] = arg
# handle additional varargs parameters
......@@ -5966,6 +5970,8 @@ class SimpleCallNode(CallNode):
elif self.type.is_memoryviewslice:
self.is_temp = 1
# func_type.exception_check = True
elif self.type.is_cyp_class:
self.is_temp = 1
if self.is_temp and self.type.is_reference:
self.type = PyrexTypes.CFakeReferenceType(self.type.ref_base_type)
......@@ -6337,6 +6343,10 @@ class InlinedDefNodeCallNode(CallNode):
if i > 0: # first argument doesn't matter
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
elif arg.type.is_cyp_class:
if i > 0: # first argument doesn't matter
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
self.args[i] = arg
if some_args_in_temps:
......
......@@ -5737,7 +5737,7 @@ class SingleAssignmentNode(AssignmentNode):
if use_temp or rhs.is_attribute or (
not rhs.is_name and not rhs.is_literal and
rhs.type.is_pyobject):
(rhs.type.is_pyobject or rhs.type.is_cyp_class)):
# things like (cdef) attribute access are not safe (traverses pointers)
rhs = rhs.coerce_to_temp(env)
elif rhs.type.is_pyobject:
......@@ -5945,7 +5945,7 @@ class CascadedAssignmentNode(AssignmentNode):
rhs = rhs.coerce_to(lhs_types.pop(), env)
if not rhs.is_name and not rhs.is_literal and (
use_temp or rhs.is_attribute or rhs.type.is_pyobject):
use_temp or rhs.is_attribute or rhs.type.is_pyobject or rhs.type.is_cyp_class):
rhs = rhs.coerce_to_temp(env)
else:
rhs = rhs.coerce_to_simple(env)
......
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