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