mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +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
@@ -13,6 +13,7 @@ import {
|
||||
type JavaScriptSemanticScopeState,
|
||||
} from "./javascriptSemanticState.js";
|
||||
import { semanticRequireOriginCandidate } from "./javascriptSemanticRequireOrigin.js";
|
||||
import { bindingHasMemberWrites } from "./javascriptSemanticEffectLog.js";
|
||||
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
||||
import {
|
||||
completeSemanticSteps,
|
||||
@@ -269,7 +270,7 @@ export const immutableSemanticBindings = (
|
||||
mutable: binding.mutable,
|
||||
definitions: binding.definitions,
|
||||
value: evaluateSemanticBinding(binding, state),
|
||||
...(binding.memberWrites.length > 0 &&
|
||||
...(bindingHasMemberWrites(binding) &&
|
||||
binding.initializers.length === 1 &&
|
||||
binding.initializers[0]?.projection.length === 0
|
||||
? {
|
||||
|
||||
Reference in new issue
Block a user