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

Function matchLine

src/resolution/name-matcher.ts:1422–1437  ·  view source on GitHub ↗
(i: number)

Source from the content-addressed store, hash-verified

1420 : Math.max(0, enclosingScopeStartLine(ref, context) - 1);
1421
1422 const matchLine = (i: number): string | null => {
1423 const line = lines[i];
1424 if (!line) return null;
1425 // A generated/minified line (one multi-KB statement) is not something a
1426 // human-written local declaration lives on, and regexing it per ref is
1427 // pure waste — skip it rather than scan it.
1428 if (line.length > 10_000) return null;
1429 for (const re of patterns) {
1430 const m = line.match(re);
1431 if (m && m[1]) {
1432 const type = normalizeInferredTypeName(m[1]);
1433 if (type) return type;
1434 }
1435 }
1436 return null;
1437 };
1438
1439 // Incremental-scan memo (INFER_SCAN_STATES): this scan runs for EVERY
1440 // `receiver.method()` ref and was measured at 61µs/ref on kong (2.4s of

Callers 1

inferLocalReceiverTypeFunction · 0.85

Calls 1

Tested by

no test coverage detected