( base: mutableInnerOfKind<"sequence">, branch: BaseRoot )
| 187 | } |
| 188 | |
| 189 | const appendSpreadBranch = ( |
| 190 | base: mutableInnerOfKind<"sequence">, |
| 191 | branch: BaseRoot |
| 192 | ): mutableInnerOfKind<"sequence"> => { |
| 193 | const spread = branch.select({ method: "find", kind: "sequence" }) |
| 194 | if (!spread) { |
| 195 | // an array with no sequence reference is the empty tuple, which adds no |
| 196 | // elements, or unknown[] |
| 197 | return branch.select({ method: "find", kind: "exactLength" })?.rule === 0 ? |
| 198 | base |
| 199 | : appendVariadicElement(base, $ark.kw.unknown) |
| 200 | } |
| 201 | |
| 202 | if (spread.prefix) |
| 203 | for (const node of spread.prefix) appendRequiredElement(base, node) |
| 204 | if (spread.defaultables) { |
| 205 | for (const [node, def] of spread.defaultables) |
| 206 | appendDefaultableElement(base, node, def) |
| 207 | } |
| 208 | if (spread.optionals) |
| 209 | for (const node of spread.optionals) appendOptionalElement(base, node) |
| 210 | if (spread.variadic) appendVariadicElement(base, spread.variadic) |
| 211 | if (spread.postfix) |
| 212 | for (const node of spread.postfix) appendRequiredElement(base, node) |
| 213 | |
| 214 | return base |
| 215 | } |
| 216 | |
| 217 | type SequencePhase = satisfy< |
| 218 | keyof Sequence.Inner, |
no test coverage detected