Skip to content
← Back

src/ir/values/address.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
class ADDRESS: Value is
5
_next_id: int static
6
7
is_lightweight_pure: bool => value.is_lightweight_pure
8
has_address: bool => value.has_address
9
type: Type
10
value: Value
11
12
local: IR.LOCAL? public
13
14
next_name: string static is
15
let result = ".address.{_next_id}"
16
17
_next_id = _next_id + 1
18
19
return result
20
si
21
22
init(
23
value: Value,
24
type: Type
25
) is
26
super.init()
27
28
self.value = value
29
self.type = type
30
si
31
32
init(
33
value: Value
34
) is
35
init(value, value.type!)
36
si
37
38
reset_id() static is
39
_next_id = 0
40
si
41
42
accept(visitor: Visitor) is
43
visitor.visit(self)
44
si
45
46
accept_address(visitor: Visitor) is
47
visitor.visit_address(self)
48
si
49
50
to_string() -> string =>
51
"address:[{type}]({value})"
52
si
53
si