Deferred from PR #1331 review. Original comment: #1331 (comment)
Context
extractSpreadForOfWalk in src/extractors/javascript.ts does not push arrow functions assigned to non-variable_declarator parents onto funcStack. For example:
export const f = (arr) => { for (const x of arr) x(); };
The export_statement → lexical_declaration → variable_declarator chain is only tracked when the declarator is under a plain const/let/var statement. Module-level exported arrow functions that contain for-of loops will silently miss the funcStack entry, meaning calls inside the loop will not be attributed to the correct caller.
Impact
Edge case — no current benchmark failure. The gap exists silently.
Fix
Extend the variable_declarator detection in extractSpreadForOfWalk to also handle the exported form by checking if the parent chain includes export_statement.
Related
Deferred from PR #1331 review. Original comment: #1331 (comment)
Context
extractSpreadForOfWalkinsrc/extractors/javascript.tsdoes not push arrow functions assigned to non-variable_declaratorparents ontofuncStack. For example:The
export_statement → lexical_declaration → variable_declaratorchain is only tracked when the declarator is under a plainconst/let/varstatement. Module-level exported arrow functions that contain for-of loops will silently miss thefuncStackentry, meaning calls inside the loop will not be attributed to the correct caller.Impact
Edge case — no current benchmark failure. The gap exists silently.
Fix
Extend the
variable_declaratordetection inextractSpreadForOfWalkto also handle the exported form by checking if the parent chain includesexport_statement.Related
extractSpreadForOfWalk