Skip to main content

Module recursion

Module recursion 

Source
Expand description

Stack-overflow protection for the recursive analysis passes.

Expression/statement analysis recurses along the AST (e.g. a fluent ->a()->b()->… chain), and on-demand return-type inference nests whole body analyses of other files on the same stack. Worker threads usually have only 2 MiB, so deep input must grow the stack on the heap instead of aborting.

Structs§

GuardedParse
A parse result whose deeply nested AST is dropped on a stack large enough for the recursive Drop.

Constants§

STACK_SIZE
Stack size for analysis worker threads; matches rust-analyzer and ty.

Functions§

ensure_phase_stack
Runs f with at least [PHASE_RED_ZONE] of stack available.
ensure_stack
Runs f, continuing on a heap-allocated stack segment when the current one is nearly exhausted.
parse
Parses source with the default PHP version; see parse_versioned.
parse_versioned
Parses source, guaranteeing enough stack for deeply nested input.
walk_block
Guarded php_ast::owned::visitor::walk_owned_block.
walk_expr
Guarded php_ast::owned::visitor::walk_owned_expr; visitors recurse through it.
walk_stmt
Guarded php_ast::owned::visitor::walk_owned_stmt.