Skip to content
← Back

src/ir/values/store/local_argument.ghul

1
namespace IR.Values.Store is
2
use TypeTyped = Semantic.Types.Typed;
3
use SymbolBase = Semantic.Symbols.Symbol;
4
5
class LOCAL_ARGUMENT: SYMBOL, TypeTyped is
6
is_consumable: bool => value.is_consumable;
7
8
init(symbol: SymbolBase, value: IR.Values.Value) is
9
super.init(null, symbol, value);
10
si
11
12
gen(context: IR.CONTEXT) is
13
// Generator-function arguments: the CLR parameter
14
// slot doesn't exist inside MoveNext. Store routes
15
// through the state-machine frame's field. See the
16
// matching Load.LOCAL_ARGUMENT for the rationale.
17
let field_reference = IR.Values.state_machine_field_reference(symbol);
18
19
if field_reference? then
20
context.write_line("ldarg.0");
21
gen(value, context);
22
context.write_line("stfld {field_reference}");
23
return;
24
fi
25
26
gen(value, context);
27
context.write_line("starg {symbol.il_name}");
28
si
29
30
to_string() -> string =>
31
"load:[{type}]({from},\"{symbol.name}\")";
32
si
33
si