Skip to content

feat(resolver): track exported arrow functions in extractSpreadForOfWalk funcStack (JS) #1354

@carlos-alm

Description

@carlos-alm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upDeferred work from PR reviews that needs tracking

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions