mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 09:34:20 +00:00
fix(reference): preserve source scope and loader authority
Share parser-owned package and runtime facts across dependency consumers. Preserve uncertain loader requests and explicit wrapper bindings without inventing unbound require authority in known modules. Cover selected source grammar through the public MCP boundary and retain ambient/type dependencies. Open each selected directory before loading its scoped policy, retaining partial directory failures and cleanup ownership. Preserve explicit caller negation precedence and source diagnostics across inventory projections. Clarify how version comparison retains container provenance without claiming semantic drift. Use independent unknown source inputs to keep candidate-limit fixtures meaningful as conditional branch evaluation becomes more precise. Fixes #6891 Fixes #6882 Fixes #6883 Fixes #6859
This commit is contained in:
1 parent
52aeeee764
commit
d5df7fd944
24 files changed
+813
-143
No files matched your search
@@ -602,16 +602,13 @@ export const semanticBindingHasPriorValueWrite = (
|
||||
);
|
||||
};
|
||||
|
||||
/** Program `var` redeclarations retain wrapper identity until a source write. */
|
||||
/** Explicit wrapper facts and program `var` redeclarations retain their lexical identity. */
|
||||
export const commonJsWrapperBindingDeclaration = (
|
||||
node: t.Node,
|
||||
name: string,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
): JavaScriptSemanticBindingState | undefined => {
|
||||
// Parser sourceType separates explicit modules from script/CommonJS source;
|
||||
// specifier resolution mode does not establish that distinction.
|
||||
if (
|
||||
state.program.sourceType !== "script" ||
|
||||
!["module", "exports", "require", "__dirname", "__filename"].includes(
|
||||
name,
|
||||
) ||
|
||||
@@ -621,9 +618,17 @@ export const commonJsWrapperBindingDeclaration = (
|
||||
const binding = resolveSemanticBindingState(state, node, name);
|
||||
if (binding === undefined) return undefined;
|
||||
const scope = state.scopesById.get(binding.scopeId);
|
||||
return scope?.kind === "program" &&
|
||||
binding.declarationKinds.size > 0 &&
|
||||
[...binding.declarationKinds].every((kind) => kind === "var")
|
||||
if (
|
||||
scope?.kind !== "program" ||
|
||||
![...binding.declarationKinds].every((kind) => kind === "var")
|
||||
)
|
||||
return undefined;
|
||||
// The index owns explicit wrapper parameters, including ones with no source
|
||||
// redeclaration. Babel's module classification does not invalidate that fact.
|
||||
if (binding.hostOrigin === "commonjs-wrapper") return binding;
|
||||
// Without an explicit host fact, preserve the legacy script-var inference.
|
||||
return state.program.sourceType === "script" &&
|
||||
binding.declarationKinds.size > 0
|
||||
? binding
|
||||
: undefined;
|
||||
};
|
||||
Reference in new issue
Block a user