Commit dc38b785 authored by Stefan Behnel's avatar Stefan Behnel

simplification for iter-dict optimisation after moving TupleNode to new-style temp usage

parent 5c8fc43e
......@@ -142,27 +142,17 @@ class DictIterTransform(Visitor.VisitorTransform):
stats = [node.body])
if tuple_target:
temp = UtilNodes.TempHandle(Builtin.tuple_type)
temp.needs_cleanup = False # assignment steals the reference
temp_tuple = temp.ref(tuple_target.pos)
class TempTupleNode(ExprNodes.TupleNode):
# FIXME: remove this after result-code refactoring
def result(self):
return temp_tuple.result()
tuple_result = TempTupleNode(
tuple_result = ExprNodes.TupleNode(
pos = tuple_target.pos,
args = [key_temp, value_temp],
is_temp = 1,
type = Builtin.tuple_type,
)
body.stats.insert(
0, UtilNodes.TempsBlockNode(
tuple_target.pos, temps = [temp],
body = Nodes.SingleAssignmentNode(
0, Nodes.SingleAssignmentNode(
pos = tuple_target.pos,
lhs = tuple_target,
rhs = tuple_result)))
rhs = tuple_result))
else:
# execute all coercions before the assignments
coercion_stats = []
......@@ -190,14 +180,14 @@ class DictIterTransform(Visitor.VisitorTransform):
body.stats[0:0] = coercion_stats + assign_stats
result_code = [
Nodes.SingleAssignmentNode(
pos = node.pos,
lhs = pos_temp,
rhs = ExprNodes.IntNode(node.pos, value=0)),
Nodes.SingleAssignmentNode(
pos = dict_obj.pos,
lhs = dict_temp,
rhs = dict_obj),
Nodes.SingleAssignmentNode(
pos = node.pos,
lhs = pos_temp,
rhs = ExprNodes.IntNode(node.pos, value=0)),
Nodes.WhileStatNode(
pos = node.pos,
condition = ExprNodes.SimpleCallNode(
......
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