An arm of a fork by its condition, reusing the one already open for it.
(fork: Extract<WireItem, { kind: 'fork' }>, g: BranchGuard)
| 344 | |
| 345 | /** An arm of a fork by its condition, reusing the one already open for it. */ |
| 346 | function armFor(fork: Extract<WireItem, { kind: 'fork' }>, g: BranchGuard): WireArm { |
| 347 | const when = guardLabel([g]); |
| 348 | const found = fork.arms.find((a) => a.when === when); |
| 349 | if (found) return found; |
| 350 | const arm: WireArm = { when, ...(g.negated ? { not: true as const } : {}), ends: g.armExit ?? null, body: [] }; |
| 351 | fork.arms.push(arm); |
| 352 | return arm; |
| 353 | } |
| 354 | |
| 355 | /** `!` and the condition — the arm, not the decision: an `if` and its `else` differ here and nowhere else. */ |
| 356 | function armKey(g: BranchGuard): string { |
no test coverage detected