Appearance
| 1 | namespace IR.Values is | |
| 2 | use Semantic.Types.Type | |
| 3 | ||
| 4 | class DEFAULT: Value is | |
| 5 | type: Type | |
| 6 | is_value_type: bool => type.is_value_type | |
| 7 | is_value_tuple: bool => type.is_value_tuple | |
| 8 | ||
| 9 | has_address: bool => true | |
| 10 | ||
| 11 | init( | |
| 12 | type: Type | |
| 13 | ) is | |
| 14 | super.init() | |
| 15 | ||
| 16 | self.type = type | |
| 17 | si | |
| 18 | ||
| 19 | gen(context: IR.CONTEXT) is | |
| 20 | let id = TEMP.get_next_id() | |
| 21 | ||
| 22 | let body = context.current_srm_body_emitter! | |
| 23 | body.declare_local(".default.{id}", type) | |
| 24 | body.ldloc(".default.{id}") | |
| 25 | si | |
| 26 | ||
| 27 | gen_address(context: IR.CONTEXT) is | |
| 28 | let id = TEMP.get_next_id() | |
| 29 | ||
| 30 | let body = context.current_srm_body_emitter! | |
| 31 | body.declare_local(".default.{id}", type) | |
| 32 | body.ldloca(".default.{id}") | |
| 33 | si | |
| 34 | ||
| 35 | to_string() -> string => | |
| 36 | "default:[{type}]()" | |
| 37 | si | |
| 38 | si |