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

Function reachedAt

__tests__/go-ref-qualifier.test.ts:319–325  ·  view source on GitHub ↗
(file: string, snippet: string, nth = 1)

Source from the content-addressed store, hash-verified

317
318/** What the calls on the line of `file` holding `snippet` reach, as qualified names. */
319const reachedAt = (file: string, snippet: string, nth = 1): string[] => {
320 const line = lineOf(file, snippet, nth);
321 const ids = cg.getNodesInFile(file).map((n) => n.id);
322 return cg.getOutgoingEdgesFrom(ids)
323 .filter((e) => e.kind !== 'contains' && e.line === line)
324 .map((e) => cg.getNode(e.target)!.qualifiedName);
325};
326
327describe('a dotted Go call is written through its own receiver', () => {
328 it('whatever else on the line spells the name', () => {

Callers 1

Calls 5

mapMethod · 0.80
getNodeMethod · 0.80
lineOfFunction · 0.70
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected