Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
d04d671
fix(javascript): preserve vite dependency values and indexes
evenafterallisaid Oct 11, 2026
215d21b
fix(javascript): merge main and track shared Vite cache mutations
morluto Oct 13, 2026
f029c24
style: format review corrections
morluto Oct 13, 2026
1bb4b1f
fix(javascript): retain Vite cache ownership across copies
morluto Oct 13, 2026
a282791
fix(javascript): preserve Vite cache ownership facts
Oct 13, 2026
df2fa18
fix(javascript): retain cache ownership for getter overrides
Oct 13, 2026
0412c78
fix(javascript): complete Vite cache ownership cases
Oct 13, 2026
48fa42b
fix(javascript): preserve Vite cache ownership facts
morluto Oct 13, 2026
3400d75
merge(main): refresh Vite checks against current source
morluto Oct 13, 2026
c4ebe5e
Merge branch 'main' into fix/vite-dependency-values
morluto Oct 13, 2026
effdc8e
Merge branch 'main' into fix/vite-dependency-values
morluto Oct 13, 2026
e1b4e33
fix(javascript): reconcile Vite analysis with current main
evenafterallisaid Oct 14, 2026
2c501ec
fix(javascript): complete Vite cache ownership regressions
evenafterallisaid Oct 14, 2026
3b09741
Merge remote-tracking branch 'upstream/main' into fix/vite-dependency…
evenafterallisaid Oct 14, 2026
af3a1ad
fix(javascript): retain inline cache escapes and assign targets
evenafterallisaid Oct 14, 2026
a8c7631
Merge remote-tracking branch 'upstream/main' into fix/vite-dependency…
evenafterallisaid Oct 15, 2026
3a8121d
fix(javascript): track restored Vite cache identities and method effects
evenafterallisaid Oct 15, 2026
a6d61ca
fix(javascript): preserve Vite container children and property identity
evenafterallisaid Oct 15, 2026
1fcace9
Merge remote-tracking branch 'upstream/main' into fix/vite-dependency…
evenafterallisaid Oct 15, 2026
815c5d5
fix(javascript): preserve Vite cache identities and bounded projection
evenafterallisaid Oct 15, 2026
88ce916
fix(javascript): close Vite cache mutation and decoding gaps
evenafterallisaid Oct 16, 2026
b9f0f2a
fix(javascript): reconcile upstream analysis finalizers
evenafterallisaid Oct 16, 2026
7eaa00c
Merge remote-tracking branch 'upstream/main' into fix/vite-dependency…
evenafterallisaid Oct 16, 2026
6222484
fix(javascript): retain cache effects across value transfers
evenafterallisaid Oct 17, 2026
51de9d4
fix(javascript): preserve shared values returned by Vite helpers
evenafterallisaid Oct 17, 2026
b4347a2
fix(javascript): keep helper supplied tables from invalidating the de…
evenafterallisaid Oct 17, 2026
41cc28e
chore(ci): align turbo lint inputs with upstream
evenafterallisaid Oct 17, 2026
548c232
Merge remote-tracking branch 'upstream/main' into fix/vite-dependency…
evenafterallisaid Oct 17, 2026
c6efc75
fix(javascript): require plain data slots for mapped helper arguments
evenafterallisaid Oct 17, 2026
157d76f
fix(javascript): expose unproven index protocols and inert index slots
evenafterallisaid Oct 17, 2026
b11b483
chore(ci): retrigger the required run for the launched-orphan lifecyc…
evenafterallisaid Oct 17, 2026
5ac739c
fix(javascript): expose only selected tables for unproven index proto…
evenafterallisaid Oct 17, 2026
92bf31a
fix(javascript): reuse selected tables for opaque Vite mapping
evenafterallisaid Oct 17, 2026
7ee46c0
fix(javascript): retain selected Vite table allocation on escape
evenafterallisaid Oct 17, 2026
38e5026
fix(javascript): scope escaped slots to reachable cache owners
evenafterallisaid Oct 17, 2026
9455a93
merge main and preserve Vite analysis integration
evenafterallisaid Oct 18, 2026
895c2b8
fix(javascript): retain exported and inherited Vite cache identities
evenafterallisaid Oct 18, 2026
a2749a8
fix(javascript): preserve supplied prototype ownership
evenafterallisaid Oct 18, 2026
e76ff97
fix(javascript): retain uncertainty after Vite table spreads
evenafterallisaid Oct 18, 2026
8c8d36b
fix(javascript): revisit prototype proofs after late effects
evenafterallisaid Oct 18, 2026
95577bd
merge main and preserve cooperative Vite analysis
evenafterallisaid Oct 19, 2026
62628b3
fix(javascript): stop Vite decoding after effectful reads
evenafterallisaid Oct 19, 2026
1b243e8
Merge branch 'main' into fix/vite-dependency-values
gensokyo-dev Oct 19, 2026
581f875
chore: merge main and preserve Vite integration proofs
evenafterallisaid Oct 21, 2026
8acd05f
fix: repair merged export and formatting checks
evenafterallisaid Oct 24, 2026
72ce50d
fix(javascript): propagate implicit Vite cache effects
evenafterallisaid Oct 24, 2026
6edb272
chore: merge main and preserve Windows Vite validation
evenafterallisaid Oct 24, 2026
52c2a97
chore: merge current main
evenafterallisaid Oct 24, 2026
09bf40f
test(javascript): distinguish cache reads from escapes
evenafterallisaid Oct 24, 2026
ffb83ef
fix(javascript): land deferred restrictions and skip constant escapes
evenafterallisaid Oct 24, 2026
80c1c72
fix(javascript): align cache ordering with current main
evenafterallisaid Oct 25, 2026
d8e0366
fix(javascript): retain cache ownership through created prototypes
evenafterallisaid Oct 25, 2026
be11ee8
fix(javascript): retain cache ownership in loop bindings
evenafterallisaid Oct 25, 2026
b875ccd
chore: use the upstream launcher fixture repair
evenafterallisaid Oct 25, 2026
e861441
fix(javascript): separate yielded elements from array ownership
evenafterallisaid Oct 25, 2026
727475a
fix(javascript): retain values from uncertain helper selections
evenafterallisaid Oct 25, 2026
aeeca27
Merge remote-tracking branch 'origin/main' into codex/vite-1840-prove…
morluto Oct 29, 2026
e6a3ce1
fix(javascript): retain Vite output markers after integration
morluto Oct 29, 2026
f03dc0d
fix: retain upstream behavior in Vite merge
morluto Oct 29, 2026
4f7a4d6
Merge commit 'refs/rea-audit/latest-main' into codex/vite-1840-main-m…
morluto Oct 29, 2026
a9507c7
fix(javascript)!: retain Vite table values as candidates
morluto Oct 29, 2026
ccc2dff
fix: preserve Vite index uncertainty in table defaults
morluto Oct 29, 2026
1a2d032
test: verify Vite default mutation at runtime
morluto Oct 29, 2026
353e301
fix(javascript): retain inherited Vite values and iteration identity
morluto Oct 29, 2026
6baf6a8
fix(javascript)!: preserve file occurrence identity in application gr…
morluto Oct 29, 2026
eb8e1ea
fix(javascript): classify Vite initializer identifier roles
morluto Oct 29, 2026
ffd0fd1
test(javascript): retain Vite candidates with harmless property keys
morluto Oct 29, 2026
6b31f3a
test(javascript): exercise Vite property keys through CLI and MCP
morluto Oct 29, 2026
374bcb4
fix(javascript): preserve selected Vite table value ownership
morluto Oct 29, 2026
26e5551
test(javascript): exercise selected Vite values through CLI and MCP
morluto Oct 29, 2026
64c7f0e
fix(javascript): scope intrinsic exposure to mapped values
morluto Oct 29, 2026
4893a9e
fix(javascript): retain intrinsic prototype escape effects
morluto Oct 29, 2026
37fe1e1
test(javascript): exercise intrinsic prototype escapes through CLI an…
morluto Oct 29, 2026
e183bb7
fix(javascript): retain unproven descriptor effects
morluto Oct 29, 2026
8ff9445
test(javascript): exercise unknown prototype descriptors through CLI …
morluto Oct 29, 2026
9dfe1ae
test(javascript): group Vite ownership regressions by behavior
morluto Oct 29, 2026
d063b37
fix(javascript): match URL source declarations across versions
morluto Oct 29, 2026
5476350
test(javascript): exercise URL source maps through CLI and MCP
morluto Oct 29, 2026
c2766e4
fix(javascript): preserve copied value provenance
morluto Oct 29, 2026
faf6e2b
fix(javascript): index copy hazards by semantic order
morluto Oct 29, 2026
8243462
test(javascript): exercise inherited prototype copies through CLI and…
morluto Oct 29, 2026
0578fbf
fix(javascript): include prototype writes in cache read proofs
morluto Oct 29, 2026
ab92e4d
fix(javascript): invalidate helper family for shared method effects
morluto Oct 29, 2026
9f6b470
test(javascript): group prototype effect regressions
morluto Oct 29, 2026
8ae2c13
fix(javascript): preserve primitive candidates through shared effects
evenafterallisaid Oct 29, 2026
697899a
test(javascript): verify source occurrence identities at boundaries
evenafterallisaid Oct 29, 2026
a9c9d68
fix(javascript): preserve own computed table values
evenafterallisaid Oct 29, 2026
7ce8a45
test(javascript): align resource and template identity assertions
evenafterallisaid Oct 29, 2026
59a948d
test(javascript): align occurrence and input diagnostic assertions
evenafterallisaid Oct 29, 2026
cdba1cc
fix(javascript): retain bundle correspondence across container versions
evenafterallisaid Oct 29, 2026
9c119b9
chore: merge current main into vite dependency fix
evenafterallisaid Oct 29, 2026
9888267
test(javascript): compare source maps using retained session evidence
evenafterallisaid Oct 29, 2026
217801b
test(javascript): verify source map occurrence identity
evenafterallisaid Oct 29, 2026
71d723f
test(javascript): select semantic chunks and preserve file occurrences
evenafterallisaid Oct 29, 2026
0587d9d
fix(javascript): preserve copied values and source occurrence compari…
evenafterallisaid Nov 3, 2026
3999f71
test(javascript): supply application view predicate
evenafterallisaid Nov 3, 2026
5e8dbeb
test(javascript): admit module item view requests
evenafterallisaid Nov 3, 2026
64a3bd0
fix(tests): find retained checkpoints by file occurrence
evenafterallisaid Nov 4, 2026
0a88ed2
fix(javascript): preserve Vite receiver facts and index ordered writes
evenafterallisaid Nov 5, 2026
3498d44
merge main and preserve shared JavaScript source facts
evenafterallisaid Nov 5, 2026
e1996f5
fix(javascript): guard changed constructors and yield indexed sorting
evenafterallisaid Nov 6, 2026
80711fc
test(javascript): bound the snapshot ordering regression fixture
evenafterallisaid Nov 6, 2026
ee6bd3c
merge main and preserve JavaScript loader identity
evenafterallisaid Nov 8, 2026
91a2db2
merge latest main and align Electron applicability tests
evenafterallisaid Nov 8, 2026
97e86f5
fix(javascript): retain call authority and match unchanged Electron s…
evenafterallisaid Nov 9, 2026
ae97bb1
merge main and retain Vite constructor and call authority
evenafterallisaid Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(javascript): preserve Vite cache identities and bounded projection
  • Loading branch information
evenafterallisaid committed Oct 15, 2026
commit 815c5d58faa2a32cf6315923ce877d04451503e9
7 changes: 7 additions & 0 deletions docs/javascript-artifact-reconstruction.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ and aliases captured before the replacement retain possible sharing. compressed
return sequences preserve equivalent TypeScript default guards. chained calls
keep the helper invocation's exact source range.

cache ownership follows static object keys, array slots, `Object.assign` targets,
and `Object.create` prototypes. a later write through another name for the same
container can restore sharing after replacement. non-index metadata writes leave
dependency slots intact; unproven methods and callbacks keep possible mutation
explicit. table decoding, ownership propagation, and reference projection yield
cooperatively during large analyses.

RPC client syntax also contributes network endpoint candidates, in both
`analyze_javascript_application` and `analyze_web_bundle`, distinguished by
`mechanism`:
Expand Down
42 changes: 34 additions & 8 deletions src/domain/javascript/javascriptIntrinsicInvocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ export const resolveJavaScriptIntrinsicInvocation = (
node: t.CallExpression | t.OptionalCallExpression,
intrinsicPath: (node: t.Node) => readonly string[] | undefined,
boundIntrinsic: (node: t.Node) => JavaScriptIntrinsicInvocation | undefined,
intrinsicReadChanged: (node: t.Node, path: readonly string[]) => boolean,
intrinsicReadChanged: (
node: t.Node,
path: readonly string[],
readKind?: "callable" | "wrapper",
) => boolean,
): JavaScriptIntrinsicInvocation | undefined => {
const visited = new Set<t.Node>();
let callee: t.Node = node.callee;
let arguments_: JavaScriptIntrinsicInvocation["arguments"] =
expandJavaScriptInvocationArguments(node.arguments);
let receiver: t.Node | undefined;
let explicitReceiver = false;
let opaque = false;
for (;;) {
callee = unwrapJavaScriptExpression(callee).node;
if (t.isSequenceExpression(callee)) {
Expand All @@ -93,8 +98,7 @@ export const resolveJavaScriptIntrinsicInvocation = (
if (visited.has(callee)) return undefined;
visited.add(callee);
let path = intrinsicPath(callee);
if (path !== undefined && intrinsicReadChanged(callee, path))
return { kind: "opaque", path, arguments: undefined };
const changed = path !== undefined && intrinsicReadChanged(callee, path);
Comment thread
evenafterallisaid marked this conversation as resolved.
Resolved
if (path === undefined) {
if (
t.isMemberExpression(callee) ||
Expand All @@ -108,9 +112,16 @@ export const resolveJavaScriptIntrinsicInvocation = (
const bound = boundIntrinsic(callee.object);
if (
bound !== undefined &&
intrinsicReadChanged(callee, [...bound.path, method])
intrinsicReadChanged(callee, [...bound.path, method], "wrapper")
)
return { kind: "opaque", path: bound.path, arguments: undefined };
return {
kind: "opaque",
path: bound.path,
arguments: undefined,
...(bound.receiver === undefined
? {}
: { receiver: bound.receiver }),
};
receiver = arguments_?.[0];
explicitReceiver = true;
callee = callee.object;
Expand Down Expand Up @@ -140,25 +151,40 @@ export const resolveJavaScriptIntrinsicInvocation = (
: undefined;
if (!t.isExpression(callable))
return { kind: "opaque", path, arguments: undefined };
const wrapperRead =
t.isMemberExpression(callee) || t.isOptionalMemberExpression(callee);
if (
intrinsicReadChanged(callee, path, wrapperRead ? "wrapper" : "callable")
)
return {
kind: "opaque",
path,
arguments: undefined,
...(receiver === undefined ? {} : { receiver }),
};
// the callable's capture and its later invocation-property read are distinct.
opaque ||= intrinsicReadChanged(callable, path.slice(0, -1));
callee = callable;
receiver = arguments_?.[0];
explicitReceiver = true;
arguments_ = invocationArguments(method, arguments_);
continue;
}
if (path.join(".") === "intrinsic.Reflect.apply") {
if (changed) return { kind: "opaque", path, arguments: undefined };
const callable = arguments_?.[0];
if (!t.isExpression(callable)) return undefined;
if (!t.isExpression(callable))
return { kind: "opaque", path, arguments: undefined };
callee = callable;
receiver = arguments_?.[1];
explicitReceiver = true;
arguments_ = arrayArguments(arguments_?.[2]);
continue;
}
return {
kind: "known",
kind: opaque || changed ? "opaque" : "known",
path,
arguments: arguments_,
arguments: opaque || changed ? undefined : arguments_,
...(receiver === undefined ? {} : { receiver }),
};
}
Expand Down
19 changes: 12 additions & 7 deletions src/domain/javascript/javascriptModuleInterop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,29 @@ export const createSemanticModuleInterop = (
const intrinsicReadChanged = (
node: t.Node,
path: readonly string[],
readKind: "callable" | "wrapper" = "callable",
): boolean => {
const capture = capturedIntrinsic(node)?.capturedAt ?? node;
const scope = opaqueMutationPath(capture).join(".");
const read = readKind === "wrapper" ? node : capture;
const scope = opaqueMutationPath(read).join(".");
const method = path.at(-1);
const invocationMethod =
method === "bind" || method === "call" || method === "apply";
path.length > 3 &&
(method === "bind" || method === "call" || method === "apply");
return writes.some(
(write) =>
(write.scope === scope || write.scope === "intrinsic") &&
write.offset < (capture.start ?? -1) &&
(write.coverage.covers(path) ||
(invocationMethod &&
write.coverage.covers([
write.offset < (read.start ?? -1) &&
(readKind === "wrapper" && invocationMethod
? write.coverage.covers([
"intrinsic",
"Function",
"prototype",
method,
]))),
]) ||
(write.coverage.covers(path) &&
!write.coverage.covers(path.slice(0, -1)))
: write.coverage.covers(path)),
Comment thread
evenafterallisaid marked this conversation as resolved.
Resolved
);
};

Expand Down
38 changes: 36 additions & 2 deletions src/domain/javascript/javascriptSemanticMutationInitializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,26 @@ export const semanticReadInitializers = (
JavaScriptSemanticBindingState,
"initializers" | "referenceInitializers"
> => {
return selectInitializers(
binding,
readPosition(read, parents),
parents,
true,
);
};

const readPosition = (
read: t.Node,
parents: WeakMap<t.Node, t.Node>,
): StatementPosition | null => {
let position: StatementPosition | null = null;
let current = read;
for (
let parent = parents.get(current);
parent;
parent = parents.get(current)
) {
if (t.isLoop(parent)) return binding;
if (t.isLoop(parent)) return null;
if (t.isFunction(parent)) break;
if (position === null) {
if (t.isVariableDeclarator(parent)) {
Expand All @@ -387,7 +399,29 @@ export const semanticReadInitializers = (
}
current = parent;
}
return selectInitializers(binding, position, parents, true);
return position;
};

/** prove a straight-line write precedes a read in the same activation. */
export const semanticWritePrecedesRead = (
write: t.Node,
read: t.Node,
parents: WeakMap<t.Node, t.Node>,
): boolean => {
const left = directMutationPosition(write, parents);
const right = readPosition(read, parents);
return left !== null && right !== null && positionPrecedes(left, right);
};

/** retain an earlier capture when a later write belongs to the same activation. */
export const semanticReadPrecedesWrite = (
read: t.Node,
write: t.Node,
parents: WeakMap<t.Node, t.Node>,
): boolean => {
const left = readPosition(read, parents);
const right = directMutationPosition(write, parents);
return left !== null && right !== null && positionPrecedes(left, right);
};

const selectInitializers = (
Expand Down
75 changes: 55 additions & 20 deletions src/domain/javascript/javascriptSemanticObjectReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
type JavaScriptSemanticPropertyPath as PropertyPath,
} from "./javascriptSemanticPropertyPaths.js";
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
import { completeSemanticSteps } from "./javascriptSemanticTraversal.js";

export interface JavaScriptSemanticObjectReference {
readonly node: t.Node;
Expand Down Expand Up @@ -752,12 +753,17 @@ interface ObjectPropertyIndex {
// index removes the per-write scan of every property.
const propertyIndexes = new WeakMap<t.ObjectExpression, ObjectPropertyIndex>();

const objectPropertyIndex = (node: t.ObjectExpression): ObjectPropertyIndex => {
function* objectPropertyIndexSteps(
node: t.ObjectExpression,
): Generator<void, ObjectPropertyIndex> {
const cached = propertyIndexes.get(node);
if (cached !== undefined) return cached;
const keyIndependent: number[] = [];
const byName = new Map<string, number[]>();
node.properties.forEach((property, index) => {
for (let index = 0; index < node.properties.length; index++) {
if (index % 1024 === 0) yield;
const property = node.properties[index];
if (property === undefined) continue;
const name = t.isSpreadElement(property)
? null
: semanticStaticPropertyKey(property.key, property.computed);
Expand All @@ -769,34 +775,43 @@ const objectPropertyIndex = (node: t.ObjectExpression): ObjectPropertyIndex => {
name === "__proto__")
) {
keyIndependent.push(index);
return;
continue;
}
const positions = byName.get(name);
if (positions === undefined) byName.set(name, [index]);
else positions.push(index);
});
}
const index = { keyIndependent, byName };
propertyIndexes.set(node, index);
return index;
};
}

/**
* Properties in reverse source order that can affect `key`. For an exact key,
* another static name only updates bookkeeping for that other name, which
* this key never reads, so only same-name and key-independent entries remain.
*/
const relevantPropertiesInReverse = (
function* relevantPropertiesInReverseSteps(
node: t.ObjectExpression,
key: PropertyPath[number] | undefined,
): readonly ObjectLiteralMember[] => {
if (typeof key !== "string" && typeof key !== "number")
return [...node.properties].reverse();
const { keyIndependent, byName } = objectPropertyIndex(node);
): Generator<void, readonly ObjectLiteralMember[]> {
if (typeof key !== "string" && typeof key !== "number") {
const properties: ObjectLiteralMember[] = [];
for (let index = node.properties.length - 1; index >= 0; index--) {
if (index % 1024 === 0) yield;
const property = node.properties[index];
if (property !== undefined) properties.push(property);
}
return properties;
}
const { keyIndependent, byName } = yield* objectPropertyIndexSteps(node);
const named = byName.get(String(key)) ?? [];
const relevant: ObjectLiteralMember[] = [];
let left = keyIndependent.length - 1;
let right = named.length - 1;
let examined = 0;
while (left >= 0 || right >= 0) {
if (examined++ % 1024 === 0) yield;
const fromLeft =
right < 0 ||
(left >= 0 && (keyIndependent[left] ?? -1) > (named[right] ?? -1));
Expand All @@ -806,21 +821,33 @@ const relevantPropertiesInReverse = (
if (property !== undefined) relevant.push(property);
}
return relevant;
};
}

export const semanticObjectPropertyReferences = (
node: t.ObjectExpression,
path: PropertyPath,
state: JavaScriptSemanticAnalysisState,
): readonly JavaScriptSemanticObjectReference[] => {
): readonly JavaScriptSemanticObjectReference[] =>
completeSemanticSteps(
semanticObjectPropertyReferencesSteps(node, path, state),
);

/** examine the same property owner cooperatively for asynchronous analyses. */
export function* semanticObjectPropertyReferencesSteps(
node: t.ObjectExpression,
path: PropertyPath,
state: JavaScriptSemanticAnalysisState,
): Generator<void, readonly JavaScriptSemanticObjectReference[]> {
const [key, ...remaining] = path;
const references: JavaScriptSemanticObjectReference[] = [];
const overwritten = new Set<string>();
const dataOverwritten = new Set<string>();
const accessorNames = new Set<string>();
const getterNames = new Set<string>();
const setterNames = new Set<string>();
for (const property of relevantPropertiesInReverse(node, key)) {
let examined = 0;
for (const property of yield* relevantPropertiesInReverseSteps(node, key)) {
if (examined++ % 1024 === 0) yield;
if (t.isSpreadElement(property)) {
const selected = key ?? null;
if (typeof selected !== "object" && overwritten.has(String(selected)))
Expand All @@ -846,7 +873,10 @@ export const semanticObjectPropertyReferences = (
selected !== null &&
typeof selected !== "object" &&
t.isObjectExpression(property.argument) &&
objectExpressionDefinesKey(property.argument, String(selected))
(yield* semanticObjectExpressionDefinesKeySteps(
property.argument,
String(selected),
))
) {
overwritten.add(String(selected));
dataOverwritten.add(String(selected));
Expand All @@ -871,7 +901,7 @@ export const semanticObjectPropertyReferences = (
});
} else if (
typeof selected === "string" &&
!objectExpressionDefinesKey(node, selected) &&
!(yield* semanticObjectExpressionDefinesKeySteps(node, selected)) &&
t.isExpression(property.value)
) {
references.push({
Expand Down Expand Up @@ -933,19 +963,24 @@ export const semanticObjectPropertyReferences = (
}
}
return references;
};
}

const objectExpressionDefinesKey = (
export function* semanticObjectExpressionDefinesKeySteps(
root: t.ObjectExpression,
key: string,
): boolean => {
): Generator<void, boolean> {
const pending: t.ObjectExpression[] = [root];
const seen = new Set<t.ObjectExpression>();
let examined = 0;
for (let cursor = 0; cursor < pending.length; cursor++) {
const object = pending[cursor];
if (object === undefined || seen.has(object)) continue;
seen.add(object);
for (const property of object.properties) {
for (const property of yield* relevantPropertiesInReverseSteps(
object,
key,
)) {
if (examined++ % 1024 === 0) yield;
if (t.isSpreadElement(property)) {
if (t.isObjectExpression(property.argument))
pending.push(property.argument);
Expand All @@ -965,4 +1000,4 @@ const objectExpressionDefinesKey = (
}
}
return false;
};
}
Loading
Loading