(builder: IRBuilder, val: Value, line: int)
| 1253 | |
| 1254 | |
| 1255 | def emit_yield(builder: IRBuilder, val: Value, line: int) -> Value: |
| 1256 | retval = builder.coerce(val, builder.ret_types[-1], line) |
| 1257 | |
| 1258 | cls = builder.fn_info.generator_class |
| 1259 | # Create a new block for the instructions immediately following the yield expression, and |
| 1260 | # set the next label so that the next time '__next__' is called on the generator object, |
| 1261 | # the function continues at the new block. |
| 1262 | next_block = BasicBlock() |
| 1263 | next_label = len(cls.continuation_blocks) |
| 1264 | cls.continuation_blocks.append(next_block) |
| 1265 | builder.assign(cls.next_label_target, Integer(next_label), line) |
| 1266 | builder.add(Return(retval, yield_target=next_block)) |
| 1267 | builder.activate_block(next_block) |
| 1268 | |
| 1269 | add_raise_exception_blocks_to_generator_class(builder, line) |
| 1270 | |
| 1271 | assert cls.send_arg_reg is not None |
| 1272 | return cls.send_arg_reg |
| 1273 | |
| 1274 | |
| 1275 | def emit_yield_from_or_await( |
no test coverage detected
searching dependent graphs…