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