IR fixes to help symbolization of K/N
This commit is contained in:
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.assertedCast
|
||||
|
||||
@@ -218,7 +219,8 @@ fun IrBuilderWithScope.irCall(callee: IrFunction, origin: IrStatementOrigin): Ir
|
||||
IrCallImpl(startOffset, endOffset, callee.returnType, callee.symbol, callee.descriptor, origin)
|
||||
|
||||
fun IrBuilderWithScope.irDelegatingConstructorCall(callee: IrConstructor): IrDelegatingConstructorCall =
|
||||
IrDelegatingConstructorCallImpl(startOffset, endOffset, callee.returnType, callee.symbol, callee.descriptor, callee.typeParameters.size)
|
||||
IrDelegatingConstructorCallImpl(startOffset, endOffset, callee.returnType, callee.symbol, callee.descriptor,
|
||||
callee.parentAsClass.typeParameters.size, callee.valueParameters.size)
|
||||
|
||||
fun IrBuilderWithScope.irCallOp(
|
||||
callee: IrFunctionSymbol,
|
||||
|
||||
+7
@@ -50,6 +50,13 @@ class IrDelegatingConstructorCallImpl(
|
||||
descriptor: ClassConstructorDescriptor
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, descriptor.typeParametersCount, descriptor.valueParameters.size)
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrConstructorSymbol
|
||||
) : this(startOffset, endOffset, type, symbol, symbol.descriptor)
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
|
||||
@@ -442,21 +442,6 @@ fun createField(
|
||||
return IrFieldImpl(startOffset, endOffset, origin, descriptor, type)
|
||||
}
|
||||
|
||||
fun IrFunction.createDispatchReceiverParameter() {
|
||||
assert(this.dispatchReceiverParameter == null)
|
||||
|
||||
val descriptor = this.descriptor.dispatchReceiverParameter ?: return
|
||||
|
||||
this.dispatchReceiverParameter = IrValueParameterImpl(
|
||||
startOffset,
|
||||
endOffset,
|
||||
IrDeclarationOrigin.DEFINED,
|
||||
descriptor,
|
||||
this.parentAsClass.defaultType,
|
||||
null
|
||||
).also { it.parent = this }
|
||||
}
|
||||
|
||||
// In presence of `IrBlock`s, return the expression that actually serves as the value (the last one).
|
||||
tailrec fun IrExpression.removeBlocks(): IrExpression? = when (this) {
|
||||
is IrBlock -> (statements.last() as? IrExpression)?.removeBlocks()
|
||||
|
||||
Reference in New Issue
Block a user