Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type; | |
| 3 | ||
| 4 | class CONVERT: Value is | |
| 5 | type: Type; | |
| 6 | value: Value; | |
| 7 | instruction: string; | |
| 8 | ||
| 9 | init( | |
| 10 | type: Type, | |
| 11 | value: Value, | |
| 12 | instruction: string | |
| 13 | ) is | |
| 14 | super.init(); | |
| 15 | ||
| 16 | self.type = type; | |
| 17 | self.value = value; | |
| 18 | self.instruction = instruction; | |
| 19 | si | |
| 20 | ||
| 21 | gen(context: IR.CONTEXT) is | |
| 22 | gen(value, context); | |
| 23 | ||
| 24 | context.write_line(instruction, "convert to {type}"); | |
| 25 | si | |
| 26 | ||
| 27 | to_string() -> string => | |
| 28 | "cast:[{type}]({value})"; | |
| 29 | si | |
| 30 | si |