IR: make IrExpression.type mutable

This commit is contained in:
Georgy Bronnikov
2020-09-10 15:03:15 +03:00
parent fde7fc6951
commit 1f37795e08
39 changed files with 41 additions and 41 deletions
@@ -27,7 +27,7 @@ abstract class IrExpression : IrElementBase(), IrStatement, IrVarargElement, IrA
@Suppress("LeakingThis")
override var attributeOwnerId: IrAttributeContainer = this
abstract val type: IrType
abstract var type: IrType
override fun <D> transform(transformer: IrElementTransformer<D>, data: D): IrExpression =
accept(transformer, data) as IrExpression
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrBlockImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null,
) : IrBlock() {
constructor(
@@ -63,7 +63,7 @@ fun IrBlockImpl.inlineStatement(statement: IrStatement) {
class IrReturnableBlockImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrReturnableBlockSymbol,
override val origin: IrStatementOrigin? = null,
override val inlineFunctionSymbol: IrFunctionSymbol? = null
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrBreakImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var loop: IrLoop,
) : IrBreak() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrSimpleFunctionSymbol,
typeArgumentsCount: Int,
valueArgumentsCount: Int,
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrClassReferenceImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrClassifierSymbol,
override val classType: IrType
) : IrClassReference() {
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrCompositeImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null,
) : IrComposite() {
constructor(
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrConstImpl<T>(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val kind: IrConstKind<T>,
override val value: T
) : IrConst<T>() {
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrConstructorCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrConstructorSymbol,
typeArgumentsCount: Int,
override val constructorTypeArgumentsCount: Int,
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrContinueImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var loop: IrLoop,
) : IrContinue() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrDelegatingConstructorCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrConstructorSymbol,
typeArgumentsCount: Int,
valueArgumentsCount: Int
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrDoWhileLoopImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin?,
) : IrDoWhileLoop() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrDynamicMemberExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val memberName: String,
override var receiver: IrExpression
) : IrDynamicMemberExpression() {
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.utils.SmartList
class IrDynamicOperatorExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val operator: IrDynamicOperator
) : IrDynamicOperatorExpression() {
override lateinit var receiver: IrExpression
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrEnumConstructorCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrConstructorSymbol,
typeArgumentsCount: Int,
valueArgumentsCount: Int
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.utils.SmartList
class IrErrorCallExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val description: String
) : IrErrorCallExpression() {
override var explicitReceiver: IrExpression? = null
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrErrorExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val description: String
) : IrErrorExpression(), IrExpressionWithCopy {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrFunctionExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var function: IrSimpleFunction,
override val origin: IrStatementOrigin
) : IrFunctionExpression() {
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.name.Name
class IrFunctionReferenceImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrFunctionSymbol,
typeArgumentsCount: Int,
override val valueArgumentsCount: Int,
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrGetClassImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var argument: IrExpression,
) : IrGetClass() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrGetEnumValueImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrEnumEntrySymbol,
) : IrGetEnumValue() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
@@ -29,7 +29,7 @@ class IrGetFieldImpl(
override val startOffset: Int,
override val endOffset: Int,
override val symbol: IrFieldSymbol,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null,
) : IrGetField() {
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrGetObjectValueImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrClassSymbol
) : IrGetObjectValue() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrGetValueImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrValueSymbol,
override val origin: IrStatementOrigin? = null
) : IrGetValue() {
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.utils.SmartList
class IrIfThenElseImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null
) : IrWhen() {
override val branches: MutableList<IrBranch> = SmartList()
@@ -25,7 +25,7 @@ class IrInstanceInitializerCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val classSymbol: IrClassSymbol,
override val type: IrType,
override var type: IrType,
) : IrInstanceInitializerCall() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitInstanceInitializerCall(this, data)
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.name.Name
class IrLocalDelegatedPropertyReferenceImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrLocalDelegatedPropertySymbol,
override val delegate: IrVariableSymbol,
override val getter: IrSimpleFunctionSymbol,
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.name.Name
class IrPropertyReferenceImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrPropertySymbol,
typeArgumentsCount: Int,
override val field: IrFieldSymbol?,
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrRawFunctionReferenceImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrFunctionSymbol,
) : IrRawFunctionReference() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrReturnImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val returnTargetSymbol: IrReturnTargetSymbol,
override var value: IrExpression
) : IrReturn() {
@@ -29,7 +29,7 @@ class IrSetFieldImpl(
override val startOffset: Int,
override val endOffset: Int,
override val symbol: IrFieldSymbol,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null,
) : IrSetField() {
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrSetVariableImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val symbol: IrVariableSymbol,
override var value: IrExpression,
override val origin: IrStatementOrigin?
@@ -26,7 +26,7 @@ import java.util.*
class IrStringConcatenationImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType
override var type: IrType
) : IrStringConcatenation() {
constructor(
startOffset: Int,
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrSuspensionPointImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var suspensionPointIdParameter: IrVariable,
override var result: IrExpression,
override var resumeResult: IrExpression
@@ -40,7 +40,7 @@ class IrSuspensionPointImpl(
class IrSuspendableExpressionImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var suspensionPointId: IrExpression,
override var result: IrExpression
) : IrSuspendableExpression() {
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrThrowImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override var value: IrExpression,
) : IrThrow() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.utils.SmartList
class IrTryImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
) : IrTry() {
constructor(
startOffset: Int,
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrTypeOperatorCallImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val operator: IrTypeOperator,
override val typeOperand: IrType,
override var argument: IrExpression,
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.utils.SmartList
class IrVarargImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val varargElementType: IrType
) : IrVararg() {
constructor(
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrWhenImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin? = null
) : IrWhen() {
constructor(
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrWhileLoopImpl(
override val startOffset: Int,
override val endOffset: Int,
override val type: IrType,
override var type: IrType,
override val origin: IrStatementOrigin?,
) : IrWhileLoop() {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {