MCPcopy
hub / github.com/colbymchenry/codegraph / fnRefEdgesInto

Function fnRefEdgesInto

__tests__/function-ref.test.ts:34–45  ·  view source on GitHub ↗

Incoming edges to `name`'s node that came from function-as-value capture.

(cg: CodeGraph, name: string)

Source from the content-addressed store, hash-verified

32
33/** Incoming edges to `name`'s node that came from function-as-value capture. */
34function fnRefEdgesInto(cg: CodeGraph, name: string): Edge[] {
35 const targets = cg.getNodesByName(name);
36 const edges: Edge[] = [];
37 for (const t of targets) {
38 for (const e of cg.getIncomingEdges(t.id)) {
39 if (e.kind === 'references' && e.metadata?.fnRef === true) {
40 edges.push(e);
41 }
42 }
43 }
44 return edges;
45}
46
47/** Names of the source nodes of the given edges, sorted. */
48function sourceNames(cg: CodeGraph, edges: Edge[]): string[] {

Callers 1

Calls 2

getNodesByNameMethod · 0.65
getIncomingEdgesMethod · 0.45

Tested by

no test coverage detected