示例#1
0
 def op_SETUP_WITH(self, inst, contextmanager):
     assert self.blocks[inst.offset] is self.current_block
     exitpt = inst.next + inst.arg
     wth = ir.With(inst.offset, exit=exitpt)
     self.syntax_blocks.append(wth)
     self.current_block.append(ir.EnterWith(
         contextmanager=self.get(contextmanager),
         begin=inst.offset, end=exitpt, loc=self.loc,
         ))
示例#2
0
文件: test_ir.py 项目: zsoltc89/numba
 def test_with(self):
     a = ir.With(1, 3)
     b = ir.With(1, 3)
     c = ir.With(2, 3)
     d = ir.With(1, 4)
     self.check(a, same=[b], different=[c, d])