Skip to content
← Back

src/ir/values/call/struct.ghul

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