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