| 111 | * ruft, ergeben je einen Erklaerer mit einem Satz statt einer leeren Flaeche. |
| 112 | */ |
| 113 | export function buildFlowView(input: FlowViewInput): FlowView { |
| 114 | const closure = input.closure; |
| 115 | const root = closure.root; |
| 116 | const document = buildPseudocode( |
| 117 | { kind: 'closure', label: root.name }, |
| 118 | { irs: input.irs, closure }, |
| 119 | ); |
| 120 | const nodes = flowNodes(closure); |
| 121 | const sequence = flowSequence(baseNameOf(root.uri), nodes); |
| 122 | const steps = flowSteps(document); |
| 123 | const arrows = steps.map((step) => flowArrowFor(sequence, step.line)); |
| 124 | |
| 125 | const notes: string[] = []; |
| 126 | if (sequence.interactions.length === 0) { |
| 127 | notes.push(EXPLAINER_EMPTY); |
| 128 | } else { |
| 129 | notes.push(explainerCappedNote(input.depth ?? FLOW_CLOSURE_DEPTH, input.cap ?? FLOW_CLOSURE_CAP)); |
| 130 | } |
| 131 | |
| 132 | return { |
| 133 | root, |
| 134 | title: document.title, |
| 135 | document, |
| 136 | sequence, |
| 137 | steps, |
| 138 | arrows, |
| 139 | stepRows: stepRowsOf(document, root, steps), |
| 140 | notes, |
| 141 | bound: { |
| 142 | depth: input.depth ?? FLOW_CLOSURE_DEPTH, |
| 143 | cap: input.cap ?? FLOW_CLOSURE_CAP, |
| 144 | }, |
| 145 | unresolved: closure.symbols.filter((symbol) => symbol.kind === 'unknown').length, |
| 146 | }; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Welche Zeile der STEPS-Sektion zu welchem Schritt gehoert. |