IR: remove a descriptor usage
This commit is contained in:
+1
-3
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.backend.common.ir.*
|
|||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
|
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
||||||
@@ -30,7 +29,6 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
import org.jetbrains.kotlin.ir.visitors.*
|
import org.jetbrains.kotlin.ir.visitors.*
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
@ObsoleteDescriptorBasedAPI
|
|
||||||
abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val context: C) : FileLoweringPass {
|
abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val context: C) : FileLoweringPass {
|
||||||
|
|
||||||
protected object STATEMENT_ORIGIN_COROUTINE_IMPL : IrStatementOriginImpl("COROUTINE_IMPL")
|
protected object STATEMENT_ORIGIN_COROUTINE_IMPL : IrStatementOriginImpl("COROUTINE_IMPL")
|
||||||
@@ -115,7 +113,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
|
|||||||
val coroutine = builtCoroutines[expression.symbol.owner]
|
val coroutine = builtCoroutines[expression.symbol.owner]
|
||||||
?: throw Error("Non-local callable reference to suspend lambda: $expression")
|
?: throw Error("Non-local callable reference to suspend lambda: $expression")
|
||||||
val constructorParameters = coroutine.coroutineConstructor.valueParameters
|
val constructorParameters = coroutine.coroutineConstructor.valueParameters
|
||||||
val expressionArguments = expression.getArguments().map { it.second }
|
val expressionArguments = expression.getArgumentsWithIr().map { it.second }
|
||||||
assert(constructorParameters.size == expressionArguments.size) {
|
assert(constructorParameters.size == expressionArguments.size) {
|
||||||
"Inconsistency between callable reference to suspend lambda and the corresponding coroutine"
|
"Inconsistency between callable reference to suspend lambda and the corresponding coroutine"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
|||||||
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
||||||
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("unused") // used in kotlin-native
|
||||||
@ObsoleteDescriptorBasedAPI
|
@ObsoleteDescriptorBasedAPI
|
||||||
fun IrMemberAccessExpression<*>.getArguments(): List<Pair<ParameterDescriptor, IrExpression>> {
|
fun IrMemberAccessExpression<*>.getArguments(): List<Pair<ParameterDescriptor, IrExpression>> {
|
||||||
val res = mutableListOf<Pair<ParameterDescriptor, IrExpression>>()
|
val res = mutableListOf<Pair<ParameterDescriptor, IrExpression>>()
|
||||||
|
|||||||
Reference in New Issue
Block a user