From adf18bb04263e1e42e3b67911dc5e2b8dd64543f Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 19 Jul 2015 10:31:11 +0300 Subject: [PATCH] Fix assignment to tuples in IRGenerator. --- artiq/compiler/transforms/ir_generator.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/artiq/compiler/transforms/ir_generator.py b/artiq/compiler/transforms/ir_generator.py index 159dd892d..000e016cf 100644 --- a/artiq/compiler/transforms/ir_generator.py +++ b/artiq/compiler/transforms/ir_generator.py @@ -721,22 +721,22 @@ class IRGenerator(algorithm.Visitor): else: try: old_assign = self.current_assign - for index, elt in enumerate(node.elts): + for index, elt_node in enumerate(node.elts): self.current_assign = \ self.append(ir.GetAttr(old_assign, index, - name="{}.{}".format(old_assign.name, - _readable_name(index)))) - self.visit(elt) + name="{}.{}".format(old_assign.name, index)), + loc=elt_node.loc) + self.visit(elt_node) finally: self.current_assign = old_assign def visit_ListT(self, node): if self.current_assign is None: - elts = [self.visit(elt) for elt in node.elts] + elts = [self.visit(elt_node) for elt_node in node.elts] lst = self.append(ir.Alloc([ir.Constant(len(node.elts), self._size_type)], node.type)) - for index, elt in enumerate(elts): - self.append(ir.SetElem(lst, ir.Constant(index, self._size_type), elt)) + for index, elt_node in enumerate(elts): + self.append(ir.SetElem(lst, ir.Constant(index, self._size_type), elt_node)) return lst else: length = self.append(ir.Builtin("len", [self.current_assign], self._size_type))