pub fn walk_own_body<'a>(unit: &FnUnit<'a>, sink: &mut dyn EffectSink)Expand description
Walk a function-unit’s own body and drive sink over every effect site that
is evaluated in the enclosing body, per the spec’s attribution rules.
Descends into: the body suite (or lambda body expr), with-items, eager
list/set/dict-comprehension element + iterable expressions, f-string format
expressions, and — for any nested def/lambda encountered while walking
— that nested callable’s decorators and parameter default expressions
(they run when the nested def/lambda statement executes, i.e. in THIS
function’s body → charged here).
Does not descend into: a nested def body or a Lambda body (their own
units), nor a generator-expression element/condition body (lazy — only its
outermost iterable runs in the enclosing body, so only that is descended). It
also never charges annotation expressions (lazy/stringized — Task 9 inspects
them only syntactically).
Crucially it does not charge THIS unit’s OWN decorators / parameter defaults
to itself: those ran in the unit’s enclosing scope (when its own def
statement executed), not when the unit is called. They are own-body effects of
the enclosing function (or, for a top-level def, of module scope → uncounted),
and are charged there by the enclosing unit’s own walk_own_body pass.