def test_yield(self): a = ir.Yield(self.var_a, self.loc1, 0) b = ir.Yield(self.var_a, self.loc1, 0) c = ir.Yield(self.var_a, self.loc2, 0) d = ir.Yield(self.var_b, self.loc1, 0) e = ir.Yield(self.var_a, self.loc1, 1) self.check(a, same=[b, c], different=[d, e])
def op_YIELD_VALUE(self, inst, value, res): dct = self.generator_info.yield_points index = len(dct) + 1 inst = ir.Yield(value=self.get(value), index=index, loc=self.loc) yp = YieldPoint(self.current_block, inst) dct[index] = yp return self.store(inst, res)