(self: Instruction)
| 619 | } |
| 620 | |
| 621 | const getMaxSizeInternal = (self: Instruction): number => { |
| 622 | switch (self._tag) { |
| 623 | case "Empty": { |
| 624 | return 0 |
| 625 | } |
| 626 | case "Single": { |
| 627 | return 1 |
| 628 | } |
| 629 | case "Map": |
| 630 | case "WithDefault": |
| 631 | case "WithFallbackConfig": { |
| 632 | return getMaxSizeInternal(self.args as Instruction) |
| 633 | } |
| 634 | case "Both": { |
| 635 | const leftMaxSize = getMaxSizeInternal(self.left as Instruction) |
| 636 | const rightMaxSize = getMaxSizeInternal(self.right as Instruction) |
| 637 | return leftMaxSize + rightMaxSize |
| 638 | } |
| 639 | case "Variadic": { |
| 640 | const argsMaxSize = getMaxSizeInternal(self.args as Instruction) |
| 641 | return Math.floor(Option.getOrElse(self.max, () => Number.MAX_SAFE_INTEGER / 2) * argsMaxSize) |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | const getUsageInternal = (self: Instruction): Usage.Usage => { |
| 647 | switch (self._tag) { |
no outgoing calls
no test coverage detected