Skip to content
← Back

src/ir/values/size_of.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
/// The number of bytes a value of `measured` takes where it is stored,
5
/// as an element of an array holds it, as an `int`.
6
class SIZE_OF: Value is
7
/// The type whose size is taken.
8
measured: Type
9
10
type: Type
11
12
/// - measured: the type whose size is taken
13
/// - type: the type of the result, `int`
14
init(measured: Type, type: Type) is
15
super.init()
16
17
self.measured = measured
18
self.type = type
19
si
20
21
accept(visitor: Visitor) is
22
visitor.visit(self)
23
si
24
25
to_string() -> string =>
26
"size_of:[{measured}]()"
27
si
28
si