IR: fix SecondaryCtorLowering.kt

This commit is contained in:
Anton Bannykh
2021-06-24 14:39:17 +03:00
committed by Anton Bannykh
parent bd4e7ffef8
commit dbeb09af89
@@ -24,10 +24,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.isSubclassOf
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
@@ -282,11 +279,11 @@ private class CallsiteRedirectionTransformer(private val context: JsIrBackendCon
} }
val readThis = expression.run { val readThis = expression.run {
if (data!! is IrConstructor) { if (data is IrConstructor) {
val thisReceiver = klass.thisReceiver!! val thisReceiver = data.constructedClass.thisReceiver!!
IrGetValueImpl(startOffset, endOffset, thisReceiver.type, thisReceiver.symbol) IrGetValueImpl(startOffset, endOffset, thisReceiver.type, thisReceiver.symbol)
} else { } else {
val lastValueParameter = data.valueParameters.last() val lastValueParameter = data!!.valueParameters.last()
IrGetValueImpl(startOffset, endOffset, lastValueParameter.type, lastValueParameter.symbol) IrGetValueImpl(startOffset, endOffset, lastValueParameter.type, lastValueParameter.symbol)
} }
} }