Skip to content
← Back

src/ir/values/call/global.ghul

1
namespace IR.Values.Call is
2
use TypeTyped = Semantic.Types.Typed;
3
use Semantic.Types.Type;
4
5
class GLOBAL: 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
init(function: Semantic.Symbols.Function, arguments: Collections.List[Value], type: Type?) is
12
super.init();
13
14
self.function = function;
15
self.arguments = arguments;
16
17
if type? then
18
self.type = type;
19
else
20
self.type = function.return_type!;
21
fi
22
23
si
24
25
gen(context: IR.CONTEXT) is
26
for a in arguments do
27
gen(a, context);
28
od
29
30
context.write_line("call {function.get_il_reference()}");
31
si
32
33
to_string() -> string =>
34
"global-call:[{type}](\"{function.name}\",{arguments})";
35
si
36
si