mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 13:45:30 +00:00
fix(javascript): move reader effect reads into the effect log and order require and process rebinding by activation (#11356)
* refactor(javascript): move the last reader effect reads into the effect log * refactor(javascript): skip escapes when a reader asks only about member writes * fix(javascript): order require and process rebinding by activation timing (#11479) * refactor(javascript): ask one ordering whether require was rebound before a call * refactor(javascript): order process replacement by activation, like require * fix(javascript): keep instance field values out of literal-loop source ordering * fix(javascript): stop effect ordering at instance field values inside the effect semanticEffectFollowsReference proved that an assignment follows a read written inside its own right-hand side, even when the read sits in an instance field value, which runs on construction after the assignment. process = class { value = process.env.MODE; }; new process() therefore kept the original process identity, and require = class { fs = require('fs') } kept a Node module origin. The first walk now stops at instance field values like it stops at function bodies. * fix(javascript): attribute process effects that may reach the original object (#11521) * fix(javascript): attribute process effects that may reach the original object A write or escape through the global process object was attributed to node:process only when no replacement of process may precede it. Effects need the opposite question: they reach the original unless a replacement with a fresh object is proven to run before them. The effect log gains ambientReplacementPrecedes (the must counterpart of the may-observe queries), RequireOrigin owns the effect question, and member mutation asks it for direct, qualified and ambient process effects. Refs #11488 * fix(javascript): prove a process replacement with the global path reader ambientReplacementPrecedes accepted any earlier fresh assignment of the process path, even when a later write might restore the original or when the assignment went through a possible alias of the global object. The global path reader already owns definite replacement at a site (it checks the written namespace and every competing write), so the effect question asks it and keeps only the freshness check. ambientReplacementPrecedes is removed.
This commit is contained in:
1 parent
1f24b3fa57
commit
0a7d288ed8
14 files changed
+770
-261
No files matched your search
@@ -15,7 +15,7 @@ import {
|
||||
import {
|
||||
semanticGlobalProcessOrigin,
|
||||
semanticGlobalProcessPathOrigin,
|
||||
semanticOriginalGlobalProcessAt,
|
||||
semanticEffectMayReachOriginalGlobalProcess,
|
||||
semanticMutableBuiltinOrigin,
|
||||
semanticRequireExportsIdentity,
|
||||
semanticRequireOriginCandidate,
|
||||
@@ -761,7 +761,7 @@ export function* collectSemanticMemberMutationsSteps(
|
||||
path[1] === "process" &&
|
||||
path.length > 2 &&
|
||||
node !== undefined &&
|
||||
semanticOriginalGlobalProcessAt(node, state)
|
||||
semanticEffectMayReachOriginalGlobalProcess(node, state)
|
||||
)
|
||||
recordRequiredEffect("node:process", path.slice(2), "write", node);
|
||||
const selections = new Map<string, readonly string[]>();
|
||||
@@ -1068,7 +1068,11 @@ export function* collectSemanticMemberMutationsSteps(
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const globalProcess = semanticGlobalProcessPathOrigin(expression, state);
|
||||
const globalProcess = semanticGlobalProcessPathOrigin(
|
||||
expression,
|
||||
state,
|
||||
"effect",
|
||||
);
|
||||
if (globalProcess !== undefined) {
|
||||
recordRequiredEffect(
|
||||
globalProcess.specifier,
|
||||
@@ -1097,7 +1101,11 @@ export function* collectSemanticMemberMutationsSteps(
|
||||
recordedEffectCount += 1;
|
||||
clearSemanticValueCaches(state);
|
||||
}
|
||||
const processOrigin = semanticGlobalProcessOrigin(expression, state);
|
||||
const processOrigin = semanticGlobalProcessOrigin(
|
||||
expression,
|
||||
state,
|
||||
"effect",
|
||||
);
|
||||
if (processOrigin !== undefined)
|
||||
recordRequiredEffect(
|
||||
processOrigin.specifier,
|
||||
|
||||
Reference in new issue
Block a user