Skip to content
← Back

src/ir/values/convert.ghul

1
namespace IR.Values is
2
use System.Reflection.Metadata.ILOpCode
3
use Semantic.Types.Type
4
5
class CONVERT: Value is
6
type: Type
7
value: Value
8
op_code: ILOpCode
9
10
init(
11
type: Type,
12
value: Value,
13
op_code: ILOpCode
14
) is
15
super.init()
16
17
self.type = type
18
self.value = value
19
self.op_code = op_code
20
si
21
22
gen(context: IR.CONTEXT) is
23
gen(value, context)
24
25
context.current_srm_body_emitter!.op(op_code)
26
si
27
28
to_string() -> string =>
29
"cast:[{type}]({value})"
30
si
31
si