Skip to content

fix(native): add object destructuring rest-parameter resolution (Phase 8.3f parity) #1349

@carlos-alm

Description

@carlos-alm

Summary

The WASM/JS engine gains rest-parameter resolution in PR #1337 (issue #1336): when function f3({ a, ...rest }) is called as f3(obj), the JS build-edges path seeds typeMap[rest] = { type: 'obj' } so rest.method() calls resolve via the seeded object's composite typeMap keys.

The native Rust engine does not yet perform this seeding. The buildParamFlowPtsPostPass native post-pass only handles pts parameter-flow (paramBindings), not objectRestParamBindings.

Expected behaviour

Both engines should produce f3 → e4 for:

function e4() {}
var obj = { e4 };
function f3({ e1: eee1, ...eerest }) {
    eerest.e4();  // should resolve to e4
}
f3(obj);

What needs to change

In the native Rust post-pass (buildParamFlowPtsPostPass in build-edges.ts or equivalent Rust logic):

  • Extract objectRestParamBindings from the JS/WASM extractor output
  • Cross-reference with paramBindings to seed typeMap[restName] = { type: argName }
  • The composite key argName.method is already seeded by the JS extractor's object-literal property seeding (Phase 8.3f)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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