Which symbols each symbol calls, in the order the walk recorded, deduplicated.
(edges: readonly ClosureEdge[])
| 137 | |
| 138 | /** Which symbols each symbol calls, in the order the walk recorded, deduplicated. */ |
| 139 | function adjacencyOf(edges: readonly ClosureEdge[]): Map<string, string[]> { |
| 140 | const out = new Map<string, string[]>(); |
| 141 | const seen = new Set<string>(); |
| 142 | for (const edge of edges) { |
| 143 | const pair = `${edge.from} ${edge.to}`; |
| 144 | if (seen.has(pair)) { |
| 145 | continue; |
| 146 | } |
| 147 | seen.add(pair); |
| 148 | const list = out.get(edge.from) ?? []; |
| 149 | list.push(edge.to); |
| 150 | out.set(edge.from, list); |
| 151 | } |
| 152 | return out; |
| 153 | } |
| 154 | |
| 155 | /** One walkable step of the explainer: a numbered line, and where it sits in the block. */ |
| 156 | export interface FlowStep { |