mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 11:13:21 +00:00
fix(javascript): retain global escapes across repeated calls
This commit is contained in:
1 parent
4e1e9b62a7
commit
4a4e959513
2 files changed
+21
-18
No files matched your search
@@ -961,24 +961,15 @@ const createGlobalPathRead = (
|
||||
};
|
||||
byNamespace.set(namespace, effects);
|
||||
}
|
||||
// The call that escapes a receiver contains the callee being identified.
|
||||
// That escape cannot have replaced the callee before the call selects it.
|
||||
const escapePrecedesRead = effects.escapes.some((effect) => {
|
||||
const escape = effect.node;
|
||||
// Containment alone does not order deferred callback/class bodies.
|
||||
// Only a read reached without crossing such a boundary precedes escape.
|
||||
if (escape !== undefined && escape !== site) {
|
||||
let parent = state.parentsByNode.get(site);
|
||||
while (
|
||||
parent !== undefined &&
|
||||
!t.isFunction(parent) &&
|
||||
!t.isClass(parent)
|
||||
) {
|
||||
if (parent === escape) return false;
|
||||
parent = state.parentsByNode.get(parent);
|
||||
}
|
||||
}
|
||||
return semanticEffectTiming(site, escape, state) !== "after";
|
||||
const escapePrecedesRead = effects.escapes.some(({ node }) => {
|
||||
// Selecting this callee precedes exposing its own receiver. Other reads,
|
||||
// including arguments, need activation-aware ordering across repetitions.
|
||||
if (
|
||||
(t.isCallExpression(node) || t.isOptionalCallExpression(node)) &&
|
||||
node.callee === site
|
||||
)
|
||||
return false;
|
||||
return semanticEffectTiming(site, node, state) !== "after";
|
||||
});
|
||||
if (
|
||||
(escapesCovered && effects.escapes.length === 0) ||
|
||||
|
||||
Reference in new issue
Block a user