MCPcopy Index your code
hub / github.com/python/mypy / transform_while_stmt

Function transform_while_stmt

mypyc/irbuild/statement.py:612–634  ·  view source on GitHub ↗
(builder: IRBuilder, s: WhileStmt)

Source from the content-addressed store, hash-verified

610
611
612def transform_while_stmt(builder: IRBuilder, s: WhileStmt) -> None:
613 body, next, top, else_block = BasicBlock(), BasicBlock(), BasicBlock(), BasicBlock()
614 normal_loop_exit = else_block if s.else_body is not None else next
615
616 builder.push_loop_stack(top, next)
617
618 # Split block so that we get a handle to the top of the loop.
619 builder.goto_and_activate(top)
620 process_conditional(builder, s.expr, body, normal_loop_exit)
621
622 builder.activate_block(body)
623 builder.accept(s.body)
624 # Add branch to the top at the end of the body.
625 builder.goto(top)
626
627 builder.pop_loop_stack()
628
629 if s.else_body is not None:
630 builder.activate_block(else_block)
631 builder.accept(s.else_body)
632 builder.goto(next)
633
634 builder.activate_block(next)
635
636
637def transform_for_stmt(builder: IRBuilder, s: ForStmt) -> None:

Callers 1

visit_while_stmtMethod · 0.90

Calls 8

BasicBlockClass · 0.90
process_conditionalFunction · 0.90
push_loop_stackMethod · 0.80
pop_loop_stackMethod · 0.80
goto_and_activateMethod · 0.45
activate_blockMethod · 0.45
acceptMethod · 0.45
gotoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…