IR: IMPLICIT_DYNAMIC_CAST
Generate IMPLICIT_DYNAMIC_CAST for implicit casts from `dynamic` to `T`
This commit is contained in:
+6
@@ -69,6 +69,7 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass {
|
||||
|
||||
return when (expression.operator) {
|
||||
IrTypeOperator.IMPLICIT_CAST -> lowerImplicitCast(expression)
|
||||
IrTypeOperator.IMPLICIT_DYNAMIC_CAST -> lowerImplicitDynamicCast(expression)
|
||||
IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> lowerCoercionToUnit(expression)
|
||||
IrTypeOperator.IMPLICIT_INTEGER_COERCION -> lowerIntegerCoercion(expression, data)
|
||||
IrTypeOperator.IMPLICIT_NOTNULL -> lowerImplicitNotNull(expression, data)
|
||||
@@ -122,6 +123,11 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass {
|
||||
argument
|
||||
}
|
||||
|
||||
private fun lowerImplicitDynamicCast(expression: IrTypeOperatorCall) = expression.run {
|
||||
assert(operator == IrTypeOperator.IMPLICIT_DYNAMIC_CAST)
|
||||
argument
|
||||
}
|
||||
|
||||
// Note: native `instanceOf` is not used which is important because of null-behaviour
|
||||
private fun advancedCheckRequired(type: IrType) = type.isInterface() ||
|
||||
type.isArray() ||
|
||||
|
||||
Reference in New Issue
Block a user