Incoming edges to `name`'s node that came from function-as-value capture.
(cg: CodeGraph, name: string)
| 32 | |
| 33 | /** Incoming edges to `name`'s node that came from function-as-value capture. */ |
| 34 | function 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. */ |
| 48 | function sourceNames(cg: CodeGraph, edges: Edge[]): string[] { |
no test coverage detected