Skip to content
← Back

src/ir/values/store/symbol.ghul

1
namespace IR.Values.Store is
2
use TypeTyped = Semantic.Types.Typed;
3
use Semantic.Types.Type;
4
use SymbolBase = Semantic.Symbols.Symbol;
5
6
class SYMBOL: Value, TypeTyped is
7
symbol: SymbolBase;
8
symbol_as_typed: TypeTyped => cast TypeTyped?(symbol)!;
9
type: Type => symbol_as_typed.type!;
10
from: Value?;
11
value: IR.Values.Value;
12
is_consumable: bool => false;
13
14
init(from: Value?, symbol: SymbolBase, value: IR.Values.Value) is
15
super.init();
16
17
self.from = from;
18
self.symbol = symbol;
19
self.value = value;
20
si
21
22
gen(context: IR.CONTEXT) is
23
gen(from, context);
24
gen(value, context);
25
26
context.write_line("store member {symbol}");
27
si
28
29
to_string() -> string =>
30
"store:[{type}]({from},\"{symbol.name}\",{value})";
31
si
32
si