Skip to content
← Back

src/ir/values/typeof.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type;
3
4
class TYPEOF: Value is
5
type: Type;
6
typeof_type: Type;
7
8
init(
9
type: Type,
10
typeof_type: Type
11
) is
12
super.init();
13
14
self.type = type;
15
self.typeof_type = typeof_type;
16
si
17
18
gen(context: IR.CONTEXT) is
19
context.write_line("ldtoken {typeof_type.get_il_class_name()}");
20
context.write_line("call class ['System.Runtime']'System'.'Type' class ['System.Runtime']'System'.'Type'::GetTypeFromHandle(valuetype ['System.Runtime']'System'.'RuntimeTypeHandle')");
21
si
22
23
to_string() -> string =>
24
"typeof:[{type}]({typeof_type})";
25
si
26
si