forked from M-Labs/artiq
1
0
Fork 0

compiler.ir: return dict from Delay.substs, not pair iterable.

This commit is contained in:
whitequark 2015-11-24 00:01:10 +08:00
parent 02f2763ea8
commit 2a82eb7219
1 changed files with 6 additions and 5 deletions

View File

@ -1339,13 +1339,14 @@ class Delay(Terminator):
self.operands[1].uses.add(self) self.operands[1].uses.add(self)
def substs(self): def substs(self):
return zip(self.var_names, self.operands[2:]) return {key: value for key, value in zip(self.var_names, self.operands[2:])}
def _operands_as_string(self, type_printer): def _operands_as_string(self, type_printer):
substs = [] substs = self.substs()
for var_name, operand in self.substs(): substs_as_strings = []
substs.append("{}={}".format(var_name, operand)) for var_name in substs:
result = "[{}]".format(", ".join(substs)) substs_as_strings.append("{} = {}".format(var_name, substs[var_name]))
result = "[{}]".format(", ".join(substs_as_strings))
result += ", decomp {}, to {}".format(self.decomposition().as_operand(type_printer), result += ", decomp {}, to {}".format(self.decomposition().as_operand(type_printer),
self.target().as_operand(type_printer)) self.target().as_operand(type_printer))
return result return result