def op_STORE_ATTR(self, inst, target, value): attr = self.code_names[inst.arg] sa = ir.SetAttr(target=self.get(target), value=self.get(value), attr=attr, loc=self.loc) self.current_block.append(sa)
def test_setattr(self): a = ir.SetAttr(self.var_a, 'foo', self.var_b, self.loc1) b = ir.SetAttr(self.var_a, 'foo', self.var_b, self.loc1) c = ir.SetAttr(self.var_a, 'foo', self.var_b, self.loc2) d = ir.SetAttr(self.var_c, 'foo', self.var_b, self.loc1) e = ir.SetAttr(self.var_a, 'bar', self.var_b, self.loc1) f = ir.SetAttr(self.var_a, 'foo', self.var_c, self.loc1) self.check(a, same=[b, c], different=[d, e, f])