Skip to content
← Back

src/ir/values/store/instance_field.ghul

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 INSTANCE_FIELD: SYMBOL is
9
is_consumable: bool => value.is_consumable
10
11
init(from: IR.Values.Value, symbol: SymbolBase, value: IR.Values.Value) is
12
super.init(from, symbol, value)
13
14
si
15
16
gen(context: IR.CONTEXT) is
17
gen(from, context)
18
gen(value, context)
19
20
let body = context.current_srm_body_emitter!
21
body.stfld(context.resolve_field_target(cast Semantic.Symbols.Field(symbol)))
22
si
23
24
to_string() -> string =>
25
"store:[{type}]({from},\"{symbol.name}\",{value})"
26
si
27
si