Generate the body of the loop. Args: conds: a list of conditions to be evaluated (in order, with short circuiting) to gate the body of the loop remaining_loop_params: the parameters for any further nested loops; if it's empty we'll ins
(
conds: list[Expression],
remaining_loop_params: list[tuple[Lvalue, Expression, list[Expression], bool]],
)
| 429 | ) |
| 430 | |
| 431 | def loop_contents( |
| 432 | conds: list[Expression], |
| 433 | remaining_loop_params: list[tuple[Lvalue, Expression, list[Expression], bool]], |
| 434 | ) -> None: |
| 435 | """Generate the body of the loop. |
| 436 | |
| 437 | Args: |
| 438 | conds: a list of conditions to be evaluated (in order, with short circuiting) |
| 439 | to gate the body of the loop |
| 440 | remaining_loop_params: the parameters for any further nested loops; if it's empty |
| 441 | we'll instead evaluate the "gen_inner_stmts" function |
| 442 | """ |
| 443 | # Check conditions, in order, short circuiting them. |
| 444 | for cond in conds: |
| 445 | cond_val = builder.accept(cond) |
| 446 | cont_block, rest_block = BasicBlock(), BasicBlock() |
| 447 | # If the condition is true we'll skip the continue. |
| 448 | builder.add_bool_branch(cond_val, rest_block, cont_block) |
| 449 | builder.activate_block(cont_block) |
| 450 | builder.nonlocal_control[-1].gen_continue(builder, cond.line) |
| 451 | builder.goto_and_activate(rest_block) |
| 452 | |
| 453 | if remaining_loop_params: |
| 454 | # There's another nested level, so the body of this loop is another loop. |
| 455 | return handle_loop(remaining_loop_params) |
| 456 | else: |
| 457 | # We finally reached the actual body of the generator. |
| 458 | # Generate the IR for the inner loop body. |
| 459 | gen_inner_stmts() |
| 460 | |
| 461 | handle_loop(loop_params) |
| 462 |
no test coverage detected
searching dependent graphs…