Whether the last thing a block does is answer the request.
(input: ProgramInput, block: WireBlock)
| 409 | |
| 410 | /** Whether the last thing a block does is answer the request. */ |
| 411 | function repliesLast(input: ProgramInput, block: WireBlock): boolean { |
| 412 | const last = block[block.length - 1]; |
| 413 | if (!last) return false; |
| 414 | if (last.kind === 'step') return input.step(last.step)?.reply === true; |
| 415 | if (last.kind === 'block') return repliesLast(input, last.body); |
| 416 | return false; |
| 417 | } |
| 418 | |
| 419 | /** Source order: a call written inside another's arguments runs first; then by position. */ |
| 420 | function compareSites(a: ProgramSite, b: ProgramSite): number { |