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

Function reached

__tests__/pascal-helpers.test.ts:430–441  ·  view source on GitHub ↗

What the calls and references on the line marked `// marker` in `file` reach, as `kind Owner::Name`.

(file: string, marker: string)

Source from the content-addressed store, hash-verified

428
429 /** What the calls and references on the line marked `// marker` in `file` reach, as `kind Owner::Name`. */
430 function reached(file: string, marker: string): string[] {
431 const line = FILES[file]!.split('\n').findIndex((l) => l.endsWith(`// ${marker}`)) + 1;
432 expect(line, marker).toBeGreaterThan(0);
433 const out: string[] = [];
434 for (const n of cg!.getNodesInFile(file)) {
435 for (const e of cg!.getOutgoingEdges(n.id)) {
436 if ((e.kind !== 'calls' && e.kind !== 'references') || e.line !== line) continue;
437 out.push(`${e.kind} ${cg!.getNode(e.target)!.qualifiedName}`);
438 }
439 }
440 return out.sort();
441 }
442
443 it('indexes a helper as a class whose signature says what it helps', () => {
444 expect(node('TRecordHelper').kind).toBe('class');

Callers 2

windowToCeilingMethod · 0.50

Calls 4

pushMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected