Adapt to IrSimpleFunctionSymbol in IrCall

(cherry picked from commit d5a048dc3a905898fc4db71a6c518c39b5b58efe)
This commit is contained in:
Georgy Bronnikov
2020-08-10 14:37:01 +03:00
committed by Vasily Levchenko
parent 5bdcf23f24
commit de33e1c81a
6 changed files with 9 additions and 9 deletions
@@ -114,7 +114,7 @@ internal fun KotlinStubs.generateCCall(expression: IrCall, builder: IrBuilderWit
val callBuilder = KotlinToCCallBuilder(builder, this, isObjCMethod = false)
val callee = expression.symbol.owner as IrSimpleFunction
val callee = expression.symbol.owner
// TODO: consider computing all arguments before converting.
@@ -110,7 +110,7 @@ internal class WorkersBridgesBuilding(val context: Context) : DeclarationContain
startOffset = job.startOffset,
endOffset = job.endOffset,
overriddenFunction = overriddenJobDescriptor,
targetSymbol = job.symbol)
targetSymbol = jobFunction.symbol)
bridges += bridge
expression.putValueArgument(3, IrFunctionReferenceImpl(
startOffset = job.startOffset,
@@ -218,7 +218,7 @@ private fun IrBlockBodyBuilder.buildTypeSafeBarrier(function: IrFunction,
}
private fun Context.buildBridge(startOffset: Int, endOffset: Int,
overriddenFunction: OverriddenFunctionInfo, targetSymbol: IrFunctionSymbol,
overriddenFunction: OverriddenFunctionInfo, targetSymbol: IrSimpleFunctionSymbol,
superQualifierSymbol: IrClassSymbol? = null): IrFunction {
val bridge = specialDeclarationsFactory.getBridge(overriddenFunction)
@@ -715,7 +715,7 @@ private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfor
return builder.at(expression).run {
val classPtr = getRawPtr(expression.extensionReceiver!!)
callAllocAndInit(classPtr, initMethodInfo, arguments, expression, callee as IrSimpleFunction)
callAllocAndInit(classPtr, initMethodInfo, arguments, expression, callee)
}
}
@@ -753,7 +753,7 @@ private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfor
receiver = expression.dispatchReceiver ?: expression.extensionReceiver!!,
arguments = arguments,
call = expression,
method = callee as IrSimpleFunction
method = callee
)
}
}
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyClass
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
@@ -338,7 +339,7 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
?: error("A function reference expected")
val jobInvocation = IrCallImpl(expression.startOffset, expression.endOffset,
jobFunctionReference.symbol.owner.returnType,
jobFunctionReference.symbol)
jobFunctionReference.symbol as IrSimpleFunctionSymbol)
jobInvocation.putValueArgument(0, producerInvocation)
expressions += jobInvocation
@@ -665,7 +666,6 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
if (callee is IrConstructor) {
error("Constructor call should be done with IrConstructorCall")
} else {
callee as IrSimpleFunction
if (callee.isOverridable && value.superQualifierSymbol == null) {
val owner = callee.parentAsClass
val actualReceiverType = value.dispatchReceiver!!.type
@@ -1402,7 +1402,7 @@ internal object Devirtualization {
actualType: IrType,
devirtualizedCallee: DevirtualizedCallee,
arguments: List<IrExpression>): IrCall {
val actualCallee = devirtualizedCallee.callee.irFunction!!
val actualCallee = devirtualizedCallee.callee.irFunction as IrSimpleFunction
val call = IrCallImpl(
callSite.startOffset, callSite.endOffset,
actualType,
@@ -238,7 +238,7 @@ fun IrBuilderWithScope.irCall(symbol: IrFunctionSymbol, typeArguments: List<IrTy
fun IrBuilderWithScope.irCall(irFunction: IrFunction, typeArguments: List<IrType> = emptyList()) =
irCall(irFunction.symbol, typeArguments)
internal fun irCall(startOffset: Int, endOffset: Int, irFunction: IrFunction, typeArguments: List<IrType>): IrCall =
internal fun irCall(startOffset: Int, endOffset: Int, irFunction: IrSimpleFunction, typeArguments: List<IrType>): IrCall =
IrCallImpl(
startOffset, endOffset, irFunction.substitutedReturnType(typeArguments),
irFunction.symbol, typeArguments.size