Skip to content
← Back

src/ir/values/constrained.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
class CONSTRAINED: Value is
5
value: Value
6
_type: Type
7
type: Type? pure => _type
8
is_value_type: bool => false
9
10
init(
11
value: Value,
12
type: Type
13
) is
14
super.init()
15
16
self._type = type
17
self.value = ADDRESS(value, type)
18
si
19
20
init(
21
value: Value
22
) is
23
init(value, value.type!)
24
si
25
26
// Lowers to the receiver's address only. The `constrained.`
27
// prefix sits immediately before the `callvirt`, after the
28
// arguments, so the enclosing instance call emits it.
29
accept(visitor: Visitor) is
30
visitor.visit(self)
31
si
32
33
to_string() -> string =>
34
"constrained:[{type}]({value})"
35
si
36
si