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

Function fnRefEdgesInto

__tests__/function-ref.test.ts:37–48  ·  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

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

Callers 1

Calls 3

pushMethod · 0.80
getNodesByNameMethod · 0.65
getIncomingEdgesMethod · 0.65

Tested by

no test coverage detected