Skip to content
← Back

src/ir/values/load/global_anonymous_function.ghul

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