Commit e82f5b5c authored by Robert Bradshaw's avatar Robert Bradshaw

Type check after (not before) operation on inplace assignment.

parent 4eb283b6
......@@ -1629,10 +1629,12 @@ class InPlaceAssignmentNode(AssignmentNode):
def allocate_rhs_temps(self, env):
import ExprNodes
if self.lhs.type.is_pyobject or self.rhs.type.is_pyobject:
if self.lhs.type.is_pyobject:
self.rhs = self.rhs.coerce_to_pyobject(env)
elif self.rhs.type.is_pyobject:
self.rhs = self.rhs.coerce_to(self.lhs.type, env)
if self.lhs.type.is_pyobject:
self.result = ExprNodes.PyTempNode(self.pos, env)
self.result = ExprNodes.PyTempNode(self.pos, env).coerce_to(self.lhs.type, env)
self.result.allocate_temps(env)
# if use_temp:
# self.rhs = self.rhs.coerce_to_temp(env)
......@@ -1662,6 +1664,7 @@ class InPlaceAssignmentNode(AssignmentNode):
self.dup.py_result(),
self.rhs.py_result(),
code.error_goto_if_null(self.result.py_result(), self.pos)))
self.result.generate_evaluation_code(code) # May be a type check...
self.rhs.generate_disposal_code(code)
self.dup.generate_disposal_code(code)
self.lhs.generate_assignment_code(self.result, code)
......
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