The notes one callee's outgoing edges produce, strongest first.
(edges: readonly InsightEdge[], byId: ReadonlyMap<number, InsightNode>)
| 288 | |
| 289 | /** The notes one callee's outgoing edges produce, strongest first. */ |
| 290 | function notesOf(edges: readonly InsightEdge[], byId: ReadonlyMap<number, InsightNode>): StepInsight[] { |
| 291 | const raised = named(edges, RELATION.raises, byId); |
| 292 | const env = named(edges, RELATION.configures, byId); |
| 293 | const calls = edges.filter((edge) => edge.type === RELATION.calls).length; |
| 294 | |
| 295 | const notes: StepInsight[] = []; |
| 296 | // Raised errors first: of the three, it is the one a reader of the calling |
| 297 | // code cannot see at all and the one that changes what they do next. |
| 298 | if (raised.length > 0) { |
| 299 | notes.push({ kind: 'raises', text: listed(raised, insightRaises) }); |
| 300 | } |
| 301 | for (const key of env.slice(0, STEP_INSIGHT_CAP)) { |
| 302 | notes.push({ kind: 'reads-env', text: insightReadsEnv(key) }); |
| 303 | } |
| 304 | if (env.length > STEP_INSIGHT_CAP) { |
| 305 | notes.push({ kind: 'reads-env', text: insightMore(env.length - STEP_INSIGHT_CAP) }); |
| 306 | } |
| 307 | if (calls > 0) { |
| 308 | notes.push({ kind: 'calls-on', text: insightCalls(calls) }); |
| 309 | } |
| 310 | return notes; |
| 311 | } |
| 312 | |
| 313 | /** The names one relation points at, deduplicated, in the graph's order. */ |
| 314 | function named( |
no test coverage detected