MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / enclosingScopeStartLine

Function enclosingScopeStartLine

src/resolution/name-matcher.ts:1353–1364  ·  view source on GitHub ↗

1-based start line of the tightest function/method enclosing the call.

(ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

1351
1352/** 1-based start line of the tightest function/method enclosing the call. */
1353function enclosingScopeStartLine(ref: UnresolvedRef, context: ResolutionContext): number {
1354 let start = 1;
1355 for (const n of context.getNodesInFile(ref.filePath)) {
1356 if (n.kind !== 'function' && n.kind !== 'method') continue;
1357 if (n.language !== ref.language) continue;
1358 const end = n.endLine ?? n.startLine;
1359 if (n.startLine <= ref.line && end >= ref.line && n.startLine >= start) {
1360 start = n.startLine;
1361 }
1362 }
1363 return start;
1364}
1365
1366/**
1367 * Infer a receiver's type from its local declaration/initializer in the

Callers 1

inferLocalReceiverTypeFunction · 0.85

Calls 1

getNodesInFileMethod · 0.65

Tested by

no test coverage detected