Skip to content
← Back

src/ir/values/call/static.ghul

1
namespace IR.Values.Call is
2
use TypeTyped = Semantic.Types.Typed;
3
use Semantic.Types.Type;
4
5
class STATIC: Value, TypeTyped is
6
is_state_changing_call: bool => !function.is_store_free;
7
function: Semantic.Symbols.Function;
8
arguments: Collections.List[Value];
9
type: Type;
10
11
// The bound type parameter a static interface member is
12
// reached through, when it needs the CLR's `constrained.`
13
// dispatch prefix; null otherwise.
14
constrained_receiver: Type?;
15
16
init(function: Semantic.Symbols.Function, arguments: Collections.List[Value], type: Type?, constrained_receiver: Type?) is
17
super.init();
18
19
self.function = function;
20
self.arguments = arguments;
21
self.constrained_receiver = constrained_receiver;
22
23
if type? then
24
self.type = type;
25
else
26
self.type = function.return_type!;
27
fi
28
si
29
30
gen(context: IR.CONTEXT) is
31
for a in arguments do
32
gen(a, context);
33
od
34
35
if constrained_receiver? then
36
context.write_line("constrained. {constrained_receiver!.get_il_type()}");
37
fi
38
39
context.write_line("call {function.get_il_reference()}");
40
si
41
42
to_string() -> string =>
43
"static-call:[{type}](\"{function.name}\",{arguments})";
44
si
45
si