(self: Instruction)
| 850 | } |
| 851 | |
| 852 | const getMinSizeInternal = (self: Instruction): number => { |
| 853 | switch (self._tag) { |
| 854 | case "Empty": |
| 855 | case "WithDefault": |
| 856 | case "WithFallback": { |
| 857 | return 0 |
| 858 | } |
| 859 | case "Single": |
| 860 | case "KeyValueMap": { |
| 861 | return 1 |
| 862 | } |
| 863 | case "Map": { |
| 864 | return getMinSizeInternal(self.options as Instruction) |
| 865 | } |
| 866 | case "Both": { |
| 867 | const leftMinSize = getMinSizeInternal(self.left as Instruction) |
| 868 | const rightMinSize = getMinSizeInternal(self.right as Instruction) |
| 869 | return leftMinSize + rightMinSize |
| 870 | } |
| 871 | case "OrElse": { |
| 872 | const leftMinSize = getMinSizeInternal(self.left as Instruction) |
| 873 | const rightMinSize = getMinSizeInternal(self.right as Instruction) |
| 874 | return Math.min(leftMinSize, rightMinSize) |
| 875 | } |
| 876 | case "Variadic": { |
| 877 | const selfMinSize = Option.getOrElse(self.min, () => 0) |
| 878 | const argumentOptionMinSize = getMinSizeInternal(self.argumentOption as Instruction) |
| 879 | return selfMinSize * argumentOptionMinSize |
| 880 | } |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | const getMaxSizeInternal = (self: Instruction): number => { |
| 885 | switch (self._tag) { |
no outgoing calls
no test coverage detected