JVM_IR: Copy suspend lambda's attributes
This commit is contained in:
+7
-2
@@ -108,6 +108,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
private fun generateContinuationClassForLambda(info: SuspendLambdaInfo) {
|
||||
val suspendLambda = suspendLambda.owner
|
||||
suspendLambda.createContinuationClassFor(info.function).apply {
|
||||
copyAttributes(info.reference)
|
||||
val functionNClass = context.ir.symbols.getJvmFunctionClass(info.arity + 1)
|
||||
superTypes.add(
|
||||
IrSimpleTypeImpl(
|
||||
@@ -443,7 +444,11 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
expression.acceptChildrenVoid(this)
|
||||
|
||||
if (expression.isSuspend) {
|
||||
suspendLambdas += SuspendLambdaInfo(expression.symbol.owner, (expression.type as IrSimpleType).arguments.size - 1)
|
||||
suspendLambdas += SuspendLambdaInfo(
|
||||
expression.symbol.owner,
|
||||
(expression.type as IrSimpleType).arguments.size - 1,
|
||||
expression
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -552,7 +557,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
}
|
||||
}
|
||||
|
||||
private class SuspendLambdaInfo(val function: IrFunction, val arity: Int) {
|
||||
private class SuspendLambdaInfo(val function: IrFunction, val arity: Int, val reference: IrFunctionReference) {
|
||||
lateinit var constructor: IrConstructor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
|
||||
Reference in New Issue
Block a user