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

Function fnRefEdgesInto

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

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

Callers 1

Calls 2

getNodesByNameMethod · 0.65
getIncomingEdgesMethod · 0.45

Tested by

no test coverage detected