[JS IR BE] Support cast to native interface
This commit is contained in:
+7
-1
@@ -218,7 +218,13 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass {
|
||||
toType.isArray() -> generateGenericArrayCheck(argument)
|
||||
toType.isPrimitiveArray() -> generatePrimitiveArrayTypeCheck(argument, toType)
|
||||
toType.isTypeParameter() -> generateTypeCheckWithTypeParameter(argument, toType)
|
||||
toType.isInterface() -> generateInterfaceCheck(argument, toType)
|
||||
toType.isInterface() -> {
|
||||
if ((toType.classifierOrFail.owner as IrClass).isEffectivelyExternal()) {
|
||||
generateIsObjectCheck(argument)
|
||||
} else {
|
||||
generateInterfaceCheck(argument, toType)
|
||||
}
|
||||
}
|
||||
else -> generateNativeInstanceOf(argument, toType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// FILE: castToNativeInterface.kt
|
||||
external interface I {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
// FILE: castToTypeParamBoundedByNativeInterface.kt
|
||||
external interface I {
|
||||
|
||||
Reference in New Issue
Block a user