mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 10:55:57 +00:00
fix(reference-source): respect require bindings
Reuse lexical ownership to exclude shadowed require calls while retaining native CommonJS and direct createRequire bindings. Preserve candidate edges when JavaScript or TypeScript runtime mode is unknown. Co-authored-by: Rudy Celekli <rudy@gradiahq.com>
This commit is contained in:
1 parent
f88c99021b
commit
f998fcb1cc
5 files changed
+335
-4
No files matched your search
@@ -29,6 +29,7 @@ import {
|
||||
resolveSemanticBindingState,
|
||||
semanticResolutionBlocked,
|
||||
resolveSemanticBindingFromScope,
|
||||
semanticBindingId,
|
||||
semanticScopeId,
|
||||
semanticVariableScope,
|
||||
} from "./javascriptSemanticState.js";
|
||||
@@ -105,7 +106,7 @@ export const analyzeJavaScriptSemantics = (
|
||||
|
||||
/** Recover lexical references, optionally for one name, without evaluating values or provenance. */
|
||||
export const analyzeParsedJavaScriptReferences = (
|
||||
file: ParsedJavaScriptSource,
|
||||
file: Pick<ParsedJavaScriptSource, "program">,
|
||||
name?: string,
|
||||
): readonly JavaScriptSemanticReference[] => {
|
||||
const state = createState(file.program);
|
||||
@@ -1101,7 +1102,7 @@ const createBinding = (
|
||||
kind: JavaScriptSemanticDefinition["kind"],
|
||||
mutable: boolean,
|
||||
): JavaScriptSemanticBindingState => ({
|
||||
bindingId: `${scope.scopeId}:binding:${encodeURIComponent(name)}`,
|
||||
bindingId: semanticBindingId(scope.scopeId, name),
|
||||
scopeId: scope.scopeId,
|
||||
name,
|
||||
kind,
|
||||
|
||||
Reference in new issue
Block a user