[Native] Drop irCall from IrUtils2

We can reuse the same function from common `ExpressionHelpers`
This commit is contained in:
Ivan Kylchik
2023-08-15 19:13:42 +02:00
committed by Space Team
parent 5c68ea2b64
commit 583a5496d5
14 changed files with 66 additions and 76 deletions
@@ -12,10 +12,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.typeWith
import org.jetbrains.kotlin.ir.util.isImmutable
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.ir.util.primaryConstructor
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.ir.util.*
val IrBuilderWithScope.parent get() = scope.getLocalDeclarationParent()
@@ -294,6 +291,15 @@ fun IrBuilderWithScope.irCall(callee: IrFunction, origin: IrStatementOrigin? = n
origin, superQualifierSymbol
)
fun IrBuilderWithScope.irCallWithSubstitutedType(callee: IrFunction, typeArguments: List<IrType>): IrMemberAccessExpression<*> {
val argsMap = callee.typeParameters.map { it.symbol }.zip(typeArguments).toMap()
return irCall(callee.symbol, callee.returnType.substitute(argsMap), typeArguments)
}
fun IrBuilderWithScope.irCallWithSubstitutedType(callee: IrFunctionSymbol, typeArguments: List<IrType>): IrMemberAccessExpression<*> {
return irCallWithSubstitutedType(callee.owner, typeArguments)
}
fun IrBuilderWithScope.irDelegatingConstructorCall(callee: IrConstructor): IrDelegatingConstructorCall =
IrDelegatingConstructorCallImpl(
startOffset, endOffset, context.irBuiltIns.unitType, callee.symbol,