Commit 0cccf2ab authored by Stefan Behnel's avatar Stefan Behnel

clean up some code and generate LetRefNodes in expected order for assignment unrolling

parent 185af334
...@@ -4773,7 +4773,7 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -4773,7 +4773,7 @@ class SingleAssignmentNode(AssignmentNode):
"fused_type does not take keyword arguments") "fused_type does not take keyword arguments")
fusednode = FusedTypeNode(self.rhs.pos, fusednode = FusedTypeNode(self.rhs.pos,
name = self.lhs.name, types=args) name=self.lhs.name, types=args)
fusednode.analyse_declarations(env) fusednode.analyse_declarations(env)
if self.declaration_only: if self.declaration_only:
...@@ -4781,8 +4781,8 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -4781,8 +4781,8 @@ class SingleAssignmentNode(AssignmentNode):
else: else:
self.lhs.analyse_target_declaration(env) self.lhs.analyse_target_declaration(env)
def analyse_types(self, env, use_temp = 0): def analyse_types(self, env, use_temp=0):
from . import ExprNodes, UtilNodes from . import ExprNodes
self.rhs = self.rhs.analyse_types(env) self.rhs = self.rhs.analyse_types(env)
...@@ -4927,7 +4927,7 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -4927,7 +4927,7 @@ class SingleAssignmentNode(AssignmentNode):
all = ParallelAssignmentNode(pos=self.pos, stats=assignments).analyse_expressions(env) all = ParallelAssignmentNode(pos=self.pos, stats=assignments).analyse_expressions(env)
if check_node: if check_node:
all = StatListNode(pos=self.pos, stats=[check_node, all]) all = StatListNode(pos=self.pos, stats=[check_node, all])
for ref in refs: for ref in refs[::-1]:
all = UtilNodes.LetNode(ref, all) all = UtilNodes.LetNode(ref, all)
return all return all
...@@ -4935,8 +4935,7 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -4935,8 +4935,7 @@ class SingleAssignmentNode(AssignmentNode):
from . import ExprNodes from . import ExprNodes
if not isinstance(self.lhs, ExprNodes.TupleNode): if not isinstance(self.lhs, ExprNodes.TupleNode):
return return
for arg in self.lhs.args: if any(arg.is_starred for arg in self.lhs.args):
if arg.is_starred:
return return
unrolled = self.unroll(self.rhs, len(self.lhs.args), env) unrolled = self.unroll(self.rhs, len(self.lhs.args), 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