Source
Jelly micro-test benchmark (PR #1304). spread scores 0% (0/4 named edges), more1 scores 0% (0/17 named edges).
Patterns
Spread operator in function arguments
// spread.js
function f(a1, a2, a3) { a1(); a2(); a3(); }
const xs = [() => {}, () => {}];
f(...xs, () => {});
// ← xs[0] and xs[1] are a1, a2; should resolve f's calls to their values
Array.from with mapping callback
// more1.js
const a1 = [() => {}];
Array.from(a1, function(element) {
element(); // ← element is each item from a1
this.f(); // ← this = context object
});
Array.concat combining arrays of functions
const a6 = [[() => {}], ...];
const a8 = a6.concat(a7, () => {});
a8[0][0](); // ← should resolve nested array access
Set/Map iteration
const a1 = [() => {}];
const s1 = new Set(a1);
for (const f of s1) f(); // ← f is each item from a1
What's needed
These are all variations of array element tracking — knowing what values end up in specific array indices or iterable positions:
...arr in call: elements of arr become the spread arguments
Array.from(arr, fn): fn receives elements of arr
arr.concat(...): merges arrays; index-based access resolves elements
for (x of iterable): x takes each value from the iterable
These require lightweight array-contents tracking — a form of points-to analysis for array elements.
Impact
- 4 edges in
spread, 17 edges in more1 (21 total)
- Common in functional JS patterns, utility libraries, test frameworks
Fixture
tests/benchmarks/resolution/fixtures/jelly-micro/spread/spread.js
tests/benchmarks/resolution/fixtures/jelly-micro/more1/more1.js
References
Source
Jelly micro-test benchmark (PR #1304).
spreadscores 0% (0/4 named edges),more1scores 0% (0/17 named edges).Patterns
Spread operator in function arguments
Array.from with mapping callback
Array.concat combining arrays of functions
Set/Map iteration
What's needed
These are all variations of array element tracking — knowing what values end up in specific array indices or iterable positions:
...arrin call: elements ofarrbecome the spread argumentsArray.from(arr, fn):fnreceives elements ofarrarr.concat(...): merges arrays; index-based access resolves elementsfor (x of iterable):xtakes each value from the iterableThese require lightweight array-contents tracking — a form of points-to analysis for array elements.
Impact
spread, 17 edges inmore1(21 total)Fixture
tests/benchmarks/resolution/fixtures/jelly-micro/spread/spread.jstests/benchmarks/resolution/fixtures/jelly-micro/more1/more1.jsReferences