* Ways on that wait at the same place are one place to go on from. Without * this, an `if` with no `else` — or a fork whose arms draw nothing — doubles * every way it crosses (once under its condition, once without), and a body * with eighty such checks (jsoup's `parse`) never finished: the page
(tails: readonly Tail[])
| 216 | * under-claims rather than claims a side it does not have. |
| 217 | */ |
| 218 | function mergeTails(tails: readonly Tail[]): Tail[] { |
| 219 | const byPlace = new Map<string, Tail>(); |
| 220 | for (const t of tails) { |
| 221 | const key = `${t.id}\0${t.arm ?? ''}\0${t.runs.join('\0')}`; |
| 222 | const found = byPlace.get(key); |
| 223 | if (found) found.when = found.when.filter((w) => t.when.includes(w)); |
| 224 | else byPlace.set(key, { ...t, when: [...t.when], runs: [...t.runs] }); |
| 225 | } |
| 226 | return [...byPlace.values()]; |
| 227 | } |
| 228 | |
| 229 | /** Whether anything in this block draws a box — a fork with one drawn arm is a guard clause, not a point. */ |
| 230 | function hasStep(block: WireBlock): boolean { |