| 703 | // asked of what a node is made of and pipes to: its references are a union's |
| 704 | // cases too, which it has once it's discriminated, when it's first used |
| 705 | const nodeHolds = (node: BaseNode): NodeHeld => { |
| 706 | let held = heldByNode.get(node) |
| 707 | if (!held) { |
| 708 | held = { |
| 709 | bits: |
| 710 | node.is("unit") ? holdsUnit |
| 711 | : isNarrow(node) ? holdsNarrow |
| 712 | : 0, |
| 713 | ends: endOf(node) |
| 714 | } |
| 715 | const within = |
| 716 | node.is("morph") ? [...node.children, ...node.otherRefs] : node.children |
| 717 | for (const part of within) { |
| 718 | const { bits, ends } = nodeHolds(part) |
| 719 | held.bits |= bits |
| 720 | held.ends = joinEnds(held.ends, ends) |
| 721 | } |
| 722 | heldByNode.set(node, held) |
| 723 | } |
| 724 | return held |
| 725 | } |
| 726 | |
| 727 | const nodeFacts = (node: BaseRoot): Facts | undefined => { |
| 728 | if (node.isNever() || node.topAlias) return |