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 | context.write_line(".locals init ({type.get_il_type()} '.default.{id}')"); | |
| 23 | context.write_line("ldloc '.default.{id}'"); | |
| 24 | si | |
| 25 | ||
| 26 | gen_address(context: IR.CONTEXT) is | |
| 27 | let id = TEMP.get_next_id(); | |
| 28 | ||
| 29 | context.write_line(".locals init ({type.get_il_type()} '.default.{id}')"); | |
| 30 | context.write_line("ldloca '.default.{id}'"); | |
| 31 | si | |
| 32 | ||
| 33 | to_string() -> string => | |
| 34 | "default:[{type}]()"; | |
| 35 | si | |
| 36 | si |