Skip to main content

Module statement

Module statement 

Source

Structs§

Statement

Enums§

StatementType

Traits§

PyStatementTrait
AST node types that can be used as a statement implement this type.

Functions§

body_breaks_outward
Whether a statement list contains a function-level return anywhere — looking through control flow (including nested trys and their handlers) but not into nested function or class definitions. The try lowering uses this to pick its closure’s carrier type: bodies with returns thread the returned value out through PyFlow. Does this statement list contain a break/continue that targets a loop OUTSIDE the list? A loop nested within the list owns its own breaks, so its body is not searched — but its else clause is, since a break there targets the enclosing loop, as in Python. Nested function and class bodies are separate scopes and never searched.
body_contains_function_return
loop_body_has_direct_break
Whether a loop body contains a break that belongs to that loop — looking through if/try/with blocks but not into nested loops (whose breaks are their own) or nested definitions. Loops with an else clause only need break-tracking machinery when this is true.