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) {
|
private fun generateContinuationClassForLambda(info: SuspendLambdaInfo) {
|
||||||
val suspendLambda = suspendLambda.owner
|
val suspendLambda = suspendLambda.owner
|
||||||
suspendLambda.createContinuationClassFor(info.function).apply {
|
suspendLambda.createContinuationClassFor(info.function).apply {
|
||||||
|
copyAttributes(info.reference)
|
||||||
val functionNClass = context.ir.symbols.getJvmFunctionClass(info.arity + 1)
|
val functionNClass = context.ir.symbols.getJvmFunctionClass(info.arity + 1)
|
||||||
superTypes.add(
|
superTypes.add(
|
||||||
IrSimpleTypeImpl(
|
IrSimpleTypeImpl(
|
||||||
@@ -443,7 +444,11 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
expression.acceptChildrenVoid(this)
|
expression.acceptChildrenVoid(this)
|
||||||
|
|
||||||
if (expression.isSuspend) {
|
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
|
lateinit var constructor: IrConstructor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
|
|
||||||
import helpers.*
|
import helpers.*
|
||||||
|
|||||||
Reference in New Issue
Block a user