Problem
Both the WASM (buildCallEdgesJS) and native (buildObjectRestParamPostPass) Phase 8.3f seeding paths key the typeMap entry by restName alone (e.g. rest):
typeMap.set(orpb.restName, { type: pb.argName, confidence: 0.65 });
If two functions in the same file both use ...rest as their rest binding:
function f1({ a, ...rest }) { rest.method(); }
function f2({ b, ...rest }) { rest.method(); }
f1(obj1);
f2(obj2);
The first seeding wins via the !typeMap.has(restName) guard, so f2's rest binding resolves to obj1 instead of obj2.
Fix
Scope the typeMap key to include the enclosing function name (e.g. f1::rest). The resolution path in resolveByMethodOrGlobal would then need to look up the scoped key using the current caller context.
This requires coordinated changes in both the seeding and the resolution lookup.
Scope
Out of scope for PR #1355 (Phase 8.3f). Affects both WASM and native paths equally.
Problem
Both the WASM (
buildCallEdgesJS) and native (buildObjectRestParamPostPass) Phase 8.3f seeding paths key the typeMap entry byrestNamealone (e.g.rest):If two functions in the same file both use
...restas their rest binding:The first seeding wins via the
!typeMap.has(restName)guard, sof2's rest binding resolves toobj1instead ofobj2.Fix
Scope the typeMap key to include the enclosing function name (e.g.
f1::rest). The resolution path inresolveByMethodOrGlobalwould then need to look up the scoped key using the current caller context.This requires coordinated changes in both the seeding and the resolution lookup.
Scope
Out of scope for PR #1355 (Phase 8.3f). Affects both WASM and native paths equally.