Appearance
| 1 | namespace IR.Values.Store is | |
| 2 | use SymbolBase = Semantic.Symbols.Symbol | |
| 3 | ||
| 4 | // The cast to the symbol's expected kind is a checked construction | |
| 5 | // invariant: the caller only ever builds this value with a symbol of | |
| 6 | // that kind, so a throw here means the invariant broke elsewhere. | |
| 7 | @suppress("cast-may-throw") | |
| 8 | class GLOBAL_FIELD: SYMBOL is | |
| 9 | is_consumable: bool => value.is_consumable | |
| 10 | ||
| 11 | init(symbol: SymbolBase, value: IR.Values.Value) is | |
| 12 | super.init(null, symbol, value) | |
| 13 | si | |
| 14 | ||
| 15 | gen(context: IR.CONTEXT) is | |
| 16 | gen(value, context) | |
| 17 | ||
| 18 | let body = context.current_srm_body_emitter! | |
| 19 | body.stsfld(context.resolve_field_target(cast Semantic.Symbols.Field(symbol))) | |
| 20 | si | |
| 21 | ||
| 22 | to_string() -> string => | |
| 23 | "store:[{type}](\"{symbol.name}\",{value})" | |
| 24 | si | |
| 25 | si | |
| 26 |