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

Function refsToRun

__tests__/go-shadowed-function-value.test.ts:234–246  ·  view source on GitHub ↗

`L ` of each `references` edge from `fromName` to the package `func run`.

(fromName: string, kind: 'function' | 'variable' = 'function')

Source from the content-addressed store, hash-verified

232
233 /** `L<line>` of each `references` edge from `fromName` to the package `func run`. */
234 function refsToRun(fromName: string, kind: 'function' | 'variable' = 'function'): string[] {
235 const from = cg!.getNodesByKind(kind).find((n) => n.name === fromName);
236 expect(from, fromName).toBeDefined();
237 return cg!
238 .getOutgoingEdges(from!.id)
239 .filter((e) => e.kind === 'references')
240 .filter((e) => {
241 const target = cg!.getNode(e.target);
242 return target?.kind === 'function' && target.name === 'run';
243 })
244 .map((e) => `L${e.line}`)
245 .sort();
246 }
247
248 it.each([
249 ['an inner block local', 'shadowThenUse', 'L14'],

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected