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

Function headerAt

src/resolution/pascal-scope.ts:824–838  ·  view source on GitHub ↗

The last of a file's header lines (see headerClassAt) at or above a line.

(headers: T[], line: number)

Source from the content-addressed store, hash-verified

822
823/** The last of a file's header lines (see headerClassAt) at or above a line. */
824function headerAt<T extends { line: number }>(headers: T[], line: number): T | undefined {
825 let lo = 0;
826 let hi = headers.length - 1;
827 let hit: T | undefined;
828 while (lo <= hi) {
829 const mid = (lo + hi) >> 1;
830 if (headers[mid]!.line <= line) {
831 hit = headers[mid];
832 lo = mid + 1;
833 } else {
834 hi = mid - 1;
835 }
836 }
837 return hit;
838}
839
840// ---------------------------------------------------------------------------
841// Scope lookup

Callers 2

headerClassAtFunction · 0.85
headerRoutineAtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected