[IR] Add REINTERPRET_CAST operator in IrTypeOperatorCall

- fix BE
 - fix Serializer
 - implement builder
 - make Ir a bit more type-correct
 - support developer mode (lowering [dynamic]implicit cast meterialized as general cast)
 - fix autoboxing lowering
This commit is contained in:
Roman Artemev
2019-11-13 17:16:49 +03:00
committed by romanart
parent 3795897fb7
commit 52b24ead91
10 changed files with 57 additions and 26 deletions
@@ -314,6 +314,9 @@ fun IrBuilderWithScope.irAs(argument: IrExpression, type: IrType) =
fun IrBuilderWithScope.irImplicitCast(argument: IrExpression, type: IrType) =
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.IMPLICIT_CAST, type, argument)
fun IrBuilderWithScope.irReinterpretCast(argument: IrExpression, type: IrType) =
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.REINTERPRET_CAST, type, argument)
fun IrBuilderWithScope.irInt(value: Int) =
IrConstImpl.int(startOffset, endOffset, context.irBuiltIns.intType, value)
@@ -49,7 +49,11 @@ enum class IrTypeOperator {
* Implicit dynamic cast: implicit cast from `dynamic` to `T`.
* This currently can happen in Kotlin/JS only.
*/
IMPLICIT_DYNAMIC_CAST;
IMPLICIT_DYNAMIC_CAST,
/**
* C-like reinterpret_cast<T> using as primitive type operation in JS
*/
REINTERPRET_CAST;
}
interface IrTypeOperatorCall : IrExpression {