Skip to content
← Back

src/ir/values/load/static_anonymous_function.ghul

1
namespace IR.Values.Load is
2
use IO.Std;
3
4
use System.NotImplementedException;
5
use System.Text.StringBuilder;
6
7
use TypeTyped = Semantic.Types.Typed;
8
use Semantic.Types.Type;
9
use SymbolBase = Semantic.Symbols.Symbol;
10
11
class STATIC_ANONYMOUS_FUNCTION: SYMBOL, TypeTyped is
12
is_consumable: bool => true;
13
14
func_type: Type;
15
16
has_address: bool => false;
17
18
init(symbol: SymbolBase, func_type: Type) is
19
super.init(null, symbol);
20
21
self.func_type = func_type;
22
si
23
24
gen(context: IR.CONTEXT) is
25
context.write_line("ldnull");
26
context.write_line("ldftn {symbol.get_il_reference()}", symbol);
27
context.write_line("newobj instance void {func_type.get_il_type()}::'.ctor'(object, native int)");
28
si
29
30
to_string() -> string =>
31
"load:[{type}]({from},\"{symbol.name}\")";
32
si
33
si