Skip to content
← Back

src/ir/values/box.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
class BOX: Value is
5
value: Value
6
7
// The type the value is boxed as, where that is not its own: a
8
// value of a type variable is boxed as the variable.
9
_boxed_type: Type?
10
11
type: Type? pure => _boxed_type ?? value.type
12
is_value_type: bool => false
13
14
init(
15
value: Value
16
) is
17
super.init()
18
19
self.value = value
20
si
21
22
init(value: Value, boxed_type: Type) is
23
self.init(value)
24
25
_boxed_type = boxed_type
26
si
27
28
accept(visitor: Visitor) is
29
visitor.visit(self)
30
si
31
32
to_string() -> string =>
33
"box:[{type}]({value})"
34
si
35
si