mirror of
https://github.com/morluto/rea
synced 2026-10-28 06:46:47 -04: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:
@@ -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