Commit 49350eb
authored
feat(resolver): Phase 8.3f — object destructuring rest parameter resolution (WASM + native) (#1355)
* feat(resolver): resolve property calls on object destructuring rest parameters (JS)
When a function parameter uses object destructuring with a rest element
(`...rest`) and the rest object's property is then called, codegraph now
resolves the callee.
Resolution chain (Phase 8.3f):
1. JS extractor seeds typeMap['obj.X'] = { type: 'X' } for shorthand
properties in object literals (`var obj = { e4 }`).
2. New extractObjectRestParamBindingsWalk records objectRestParamBinding
{ callee, argIndex, restName } from `function f({ a, ...rest })`.
3. build-edges.ts cross-references with paramBindings from f(obj) calls
to seed typeMap[restName] = { type: argName, confidence: 0.65 }.
4. resolveByMethodOrGlobal: typeMap[restName] → obj; typeMap[obj.method]
→ method → resolved edge.
Adds:
- ObjectRestParamBinding type + ExtractorOutput.objectRestParamBindings field
- objectRestParamBindings serialised through WASM worker boundary
- extractObjectRestParamBindingsWalk in javascript.ts
- Object literal shorthand property seeding in handleVarDeclaratorTypeMap
- Phase 8.3f typeMap seeding in buildCallEdgesJS
- 6 unit tests in tests/parsers/javascript.test.ts
- Integration test (WASM engine) in issue-1336-object-rest-param-resolution.test.ts
- Jelly micro-test fixture tests/benchmarks/resolution/fixtures/jelly-micro/rest/
Files issue #1348 (missing WASM worker serialisation for paramBindings/
returnTypeMap/callAssignments) and #1349 (native engine parity) as follow-ups.
Closes #1336
* fix(native): add object destructuring rest-parameter resolution (Phase 8.3f parity)
Add buildObjectRestParamPostPass to the native call-edge path, mirroring the
Phase 8.3f seeding already present in buildCallEdgesJS (WASM path).
The post-pass seeds typeMap[restName] = { type: argName } by cross-referencing
objectRestParamBindings (which formal param uses a rest binding) with
paramBindings (which call-site arg was passed). It then resolves calls whose
receiver is the rest-binding name via resolveCallTargets with the enriched
typeMap, adding any edges the native Rust engine missed.
For same-file and directly-imported callees, the native Rust engine already
resolves via its own same-file (step 2) and import-aware (step 1) lookups;
seenByPair prevents duplicate edges. The post-pass provides the typeMap-chain
fallback for the cross-file non-imported case where the chain
typeMap[restName] → argName → typeMap[argName.method] → target resolves
a callee the Rust engine cannot find.
Also updates the #1336 integration test to assert both WASM and native engines
produce the f3 → e4 edge.
Closes #1349
* feat(extractor): extend rest-param binding walk to class and object-literal methods (#1357)
docs check acknowledged
* fix(resolver): defensive-copy typeMap in buildCallEdgesJS Phase 8.3f block
Native buildObjectRestParamPostPass already clones symbols.typeMap before seeding
(line 755); the WASM path buildCallEdgesJS was taking a direct reference, causing
Phase 8.3f seeds to persist into symbols.typeMap across watch/incremental builds
and blocking correct re-seeding when call-site arguments changed.
Tracks rest-param scoping gap (two functions with same restName in one file) in
issue #1358.
* test(1336): add dynamic:0 assertion to native engine integration test
Native test for the rest-receiver edge (f3 → e4) was only checking that the
edge exists; it now also asserts dynamic===0, matching the WASM test. This
ensures a dynamic-dispatch fallback in the native engine is caught as a
regression.
* fix(extractor): use slice(1, -1) instead of global regex in rest-param binding walk (#1355)
* fix(tests): restore integration tests and jelly-micro fixtures dropped in prior merge (#1355)
Re-add func-prop-this-dispatch.test.ts, prototype-method-resolution.test.ts,
and jelly-micro benchmark fixtures (this/, spread/, more1/) that were
accidentally excluded when resolving an earlier merge conflict with main.
These files were introduced in main via PR #1331 and provide integration-level
coverage for features #1334 and #1317. Their absence meant regressions in
this-dispatch and prototype method resolution would not be caught by CI.
* fix(extractor): guard against computed property keys in rest-param binding walk (#1355)1 parent fb60836 commit 49350eb
4 files changed
Lines changed: 425 additions & 38 deletions
File tree
- src
- domain/graph/builder/stages
- extractors
- tests
- integration
- parsers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
712 | 804 | | |
713 | 805 | | |
714 | 806 | | |
| |||
923 | 1015 | | |
924 | 1016 | | |
925 | 1017 | | |
926 | | - | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
927 | 1038 | | |
928 | 1039 | | |
929 | 1040 | | |
| |||
1679 | 1790 | | |
1680 | 1791 | | |
1681 | 1792 | | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1682 | 1796 | | |
1683 | 1797 | | |
1684 | 1798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2293 | 2293 | | |
2294 | 2294 | | |
2295 | 2295 | | |
2296 | | - | |
| 2296 | + | |
2297 | 2297 | | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
2301 | 2303 | | |
2302 | 2304 | | |
2303 | 2305 | | |
2304 | 2306 | | |
2305 | 2307 | | |
2306 | | - | |
| 2308 | + | |
2307 | 2309 | | |
2308 | 2310 | | |
2309 | | - | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | | - | |
2329 | | - | |
2330 | | - | |
2331 | | - | |
2332 | | - | |
2333 | | - | |
2334 | | - | |
2335 | | - | |
2336 | | - | |
2337 | | - | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
2338 | 2377 | | |
2339 | 2378 | | |
2340 | | - | |
2341 | 2379 | | |
2342 | 2380 | | |
| 2381 | + | |
2343 | 2382 | | |
2344 | 2383 | | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
2345 | 2393 | | |
2346 | | - | |
| 2394 | + | |
2347 | 2395 | | |
2348 | 2396 | | |
2349 | | - | |
| 2397 | + | |
2350 | 2398 | | |
2351 | 2399 | | |
2352 | 2400 | | |
| |||
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
0 commit comments