Skip to content
← Back

src/ir/values/call/closure.ghul

1
namespace IR.Values.Call is
2
use TypeTyped = Semantic.Types.Typed
3
use Semantic.Types.Type
4
5
class CLOSURE: Value, TypeTyped is
6
// Invoking a function value can run anything — except through
7
// a pure function type, whose slots only admit store-free
8
// values.
9
is_state_changing_call: bool => !(func_type? /\ func_type.is_pure_function)
10
from: Value
11
type: Type
12
13
is_action: bool
14
func_type: Type?
15
arguments: Collections.List[Value]
16
17
init(
18
from: Value,
19
type: Type,
20
is_action: bool,
21
func_type: Type,
22
arguments: Collections.List[Value]
23
) is
24
super.init()
25
26
self.from = from
27
self.type = type
28
self.is_action = is_action
29
self.func_type = func_type
30
self.arguments = arguments
31
si
32
33
accept(visitor: Visitor) is
34
visitor.visit(self)
35
si
36
37
to_string() -> string =>
38
"closure-call:[{type}]({from}{arguments})"
39
si
40
si