mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
fix(javascript): keep array presence snapshots query-owned (#12511)
Reuse the capture-lifetime approach from #7716 for ordinary array-read proof. Co-authored-by: SII-YDD <38822679+SII-YDD@users.noreply.github.com>
This commit is contained in:
1 parent
e46ace9744
commit
83192e9750
4 files changed
+142
-20
No files matched your search
@@ -53,23 +53,16 @@ export const semanticKnownArrayIteration = (
|
||||
!ambientPathMayObserveAt(state, read, arrayIteratorNextPath, "contents") &&
|
||||
value.items.every((item) => semanticArrayIndex(item.name) !== null);
|
||||
|
||||
/**
|
||||
* Return the array that admits native iteration at this read. A plain array's
|
||||
* numeric properties are the values consumed by its native iterator.
|
||||
*/
|
||||
export const semanticNativeArrayIterationValueAt = (
|
||||
node: t.Node,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
) => {
|
||||
const value = evaluateSemanticExpression(node, state, node);
|
||||
return semanticKnownArrayIteration(value, state, node) ? value : undefined;
|
||||
};
|
||||
|
||||
/** Invocation spreads use the same native-iteration proof at their source read. */
|
||||
export const semanticKnownArrayIterationAt = (
|
||||
node: t.Node,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
): boolean => semanticNativeArrayIterationValueAt(node, state) !== undefined;
|
||||
): boolean =>
|
||||
semanticKnownArrayIteration(
|
||||
evaluateSemanticExpression(node, state, node),
|
||||
state,
|
||||
node,
|
||||
);
|
||||
|
||||
/** Numeric destructuring projections do not select slots of custom iterators. */
|
||||
export const semanticReferenceIterationUnknown = (
|
||||
|
||||
Reference in new issue
Block a user