Function walk_expr_scoped_mut
pub fn walk_expr_scoped_mut<F>(expr: &mut Expr, scope_depth: usize, f: F)Expand description
Walk an expression tree in pre-order, tracking scope depth through Let/Map scopes.
For each node, calls f(expr, scope_depth):
- If
freturnstrue, recursion into children continues. - If
freturnsfalse, children are skipped (e.g., when the callback has replaced the expression and doesn’t want to recurse into the replacement).
Scope depth rules:
Letbindings are visited at the current depth; the body atdepth + 1Mapbase is visited at the current depth; the map function atdepth + 1- All other compound expressions: children at the same depth
This matches the semantics of ExprArg.nesting: an arg with
nesting == scope_depth references the outermost (statement-level) scope,
while nesting < scope_depth references a Let/Map binding.