Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type; | |
| 3 | ||
| 4 | class TYPE_WRAPPER: Value is | |
| 5 | has_address: bool => value.has_address; | |
| 6 | is_lightweight_pure: bool => value.is_lightweight_pure; | |
| 7 | type: Type; | |
| 8 | value: Value; | |
| 9 | ||
| 10 | init( | |
| 11 | type: Type, | |
| 12 | value: Value | |
| 13 | ) is | |
| 14 | super.init(); | |
| 15 | ||
| 16 | // trap laundered nulls here: a null type reaching IL | |
| 17 | // generation surfaces as a misleading diagnostic far | |
| 18 | // from the cause (storage types can be null during | |
| 19 | // error recovery) | |
| 20 | assert type?; | |
| 21 | assert value?; | |
| 22 | ||
| 23 | self.type = type; | |
| 24 | self.value = value; | |
| 25 | si | |
| 26 | ||
| 27 | gen(context: IR.CONTEXT) is | |
| 28 | gen(value, context); | |
| 29 | si | |
| 30 | ||
| 31 | gen_address(context: IR.CONTEXT) is | |
| 32 | value.gen_address(context); | |
| 33 | si | |
| 34 | ||
| 35 | to_string() -> string => | |
| 36 | "type_wrapper:[{type}]({value})"; | |
| 37 | si | |
| 38 | si |