(guards: readonly BranchGuard[])
| 657 | * share, so it is the innermost that says which way this site went. |
| 658 | */ |
| 659 | const decisionOf = (guards: readonly BranchGuard[]): WireStepDecision | null => { |
| 660 | const g = guards[guards.length - 1]; |
| 661 | if (!g || !g.branch) return null; |
| 662 | // A one-sided guard (`if (!product) throw`) is a guard clause, not a |
| 663 | // choice with two drawn ways; it keeps its condition on the line. |
| 664 | if (g.form === 'guard') return null; |
| 665 | return { |
| 666 | branch: g.branch, |
| 667 | on: guardLabel([{ ...g, negated: false }]), |
| 668 | arm: guardLabel([g]), |
| 669 | form: g.form === 'case' ? 'switch' : g.form === 'ternary' ? 'ternary' : g.form === 'catch' ? 'try' : 'if', |
| 670 | ...(g.negated ? { not: true as const } : {}), |
| 671 | }; |
| 672 | }; |
| 673 | |
| 674 | const steps = new Map<string, StepRecord>(); |
| 675 | const links = new Map<string, WireStepLink>(); |
no test coverage detected