Skip to content
← Back

src/ir/values/deref.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
class DEREF: Value is
5
type: Type
6
value: Value
7
8
is_deref: bool => true
9
has_address: bool => true
10
11
init(
12
value: Value,
13
type: Type
14
) is
15
super.init()
16
17
self.value = value
18
self.type = type
19
si
20
21
init(
22
value: Value
23
) is
24
init(value, value.type!)
25
si
26
27
gen(context: IR.CONTEXT) is
28
value.gen(context)
29
let body = context.current_srm_body_emitter!
30
body.load_object(context.resolve_type_token(type))
31
si
32
33
gen_address(context: IR.CONTEXT) is
34
value.gen(context)
35
si
36
37
to_string() -> string =>
38
"deref:[{type}]({value})"
39
si
40
si