diff --git a/gitnexus/src/core/ingestion/scope-resolution/pipeline/run.ts b/gitnexus/src/core/ingestion/scope-resolution/pipeline/run.ts index e2f217b42..151f421fd 100644 --- a/gitnexus/src/core/ingestion/scope-resolution/pipeline/run.ts +++ b/gitnexus/src/core/ingestion/scope-resolution/pipeline/run.ts @@ -172,11 +172,11 @@ export function runScopeResolution( methodDispatch: buildPopulatedMethodDispatch(mroByClassDefId), }; - // Build the workspace resolution index ONCE — turns every - // findOwnedMember / findExportedDef / classScopeByDefId lookup in - // the downstream passes from O(N×D) to O(1). Must run AFTER - // populateOwners (so memberByOwner is correct) and AFTER - // finalize (so module-scope bindings are available). + // Build the workspace resolution index ONCE — scope-valued lookups + // (`classScopeByDefId`, `moduleScopeByFile`) that `SemanticModel` + // cannot carry. Must run AFTER `populateOwners` (so owned defs are + // attributed correctly) and AFTER finalize (so module-scope + // bindings are available). const workspaceIndex = buildWorkspaceResolutionIndex(parsedFiles); // Cross-file implicit-namespace visibility (C#). Must run before diff --git a/gitnexus/src/core/ingestion/scope-resolution/scope/walkers.ts b/gitnexus/src/core/ingestion/scope-resolution/scope/walkers.ts index a42fbeeb8..c92483b4e 100644 --- a/gitnexus/src/core/ingestion/scope-resolution/scope/walkers.ts +++ b/gitnexus/src/core/ingestion/scope-resolution/scope/walkers.ts @@ -292,10 +292,12 @@ export function findExportedDefByName( } // Workspace-wide fallback: iterate every file's Module scope (via // the scope-tied `moduleScopeByFile` lookup) and return the first - // locally-declared callable binding matching `name`. Mirrors the - // original `callablesBySimpleName[0]` semantics — first-seen-by- - // file wins, bindings filtered to `origin === 'local'` and the - // callable types Function/Method/Constructor. + // locally-declared callable binding matching `name`. First-seen- + // by-file wins; bindings filtered to `origin === 'local'` and the + // callable types Function/Method/Constructor. We walk scopes here + // rather than consult `SemanticModel.symbols.lookupCallableByName` + // because the `origin === 'local'` module-export-visibility filter + // is a scope concept the raw symbol index doesn't express. for (const [, moduleScope] of index.moduleScopeByFile) { const refs = moduleScope.bindings.get(name); if (refs === undefined) continue;