Appearance
| 1 | namespace IR.Values.Literal is | |
| 2 | use TypeTyped = Semantic.Types.Typed; | |
| 3 | use Semantic.Types.Type; | |
| 4 | ||
| 5 | class NUMBER: Value, TypeTyped is | |
| 6 | value: string; | |
| 7 | type: Type; | |
| 8 | suffix: string; | |
| 9 | conv: string?; | |
| 10 | is_lightweight_pure: bool => true; | |
| 11 | ||
| 12 | init(value: string, type: Type, suffix: string, conv: string?) is | |
| 13 | super.init(); | |
| 14 | ||
| 15 | self.value = value; | |
| 16 | self.type = type; | |
| 17 | self.suffix = suffix; | |
| 18 | self.conv = conv; | |
| 19 | si | |
| 20 | ||
| 21 | init(value: string, type: Type, suffix: string) is | |
| 22 | self.init(value, type, suffix, null); | |
| 23 | si | |
| 24 | ||
| 25 | gen(context: IR.CONTEXT) is | |
| 26 | context.write_line("ldc.{suffix} {value}"); | |
| 27 | ||
| 28 | if conv? then | |
| 29 | context.write_line(conv!); | |
| 30 | fi | |
| 31 | si | |
| 32 | ||
| 33 | to_string() -> string => | |
| 34 | "literal:[{type}]({value})"; | |
| 35 | si | |
| 36 | si |