fix(javascript): preserve dependencies for projected array sources (#12519)

This commit is contained in:
morluto authored and GitHub committed 2026-11-19 20:48:47 +00:00
1 parent 1ec32721af
commit 16e4eec122
5 files changed
+224 -31

No files matched your search

@@ -2074,7 +2074,19 @@ export function* collectSemanticMemberMutationsSteps(
continue;
}
}
const slot = semanticSelectedReferenceSlot(reference, state);
const { mutation, node, projection } = reference;
// A root array pattern acquires its iterator from the completed RHS.
// A nested iterator can run after earlier pattern reads and defaults.
const capturesRootPattern =
reference.iterationOnly &&
projection.length === 0 &&
((t.isVariableDeclarator(mutation) && mutation.init === node) ||
(t.isAssignmentExpression(mutation) && mutation.right === node));
const slot = semanticSelectedReferenceSlot(
reference,
state,
capturesRootPattern ? node : undefined,
);
// Custom iteration can yield the iterable itself as well as any child.
// Treat its root as escaped, including writes through yielded references.
const knownArray = semanticKnownArrayIteration(