JVM_IR: actually forward the parameters to $suspendImpl
This commit is contained in:
+2
-8
@@ -502,7 +502,6 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
|
|
||||||
private fun createStaticSuspendImpl(irFunction: IrSimpleFunction): IrSimpleFunction {
|
private fun createStaticSuspendImpl(irFunction: IrSimpleFunction): IrSimpleFunction {
|
||||||
// Create static suspend impl method.
|
// Create static suspend impl method.
|
||||||
val backendContext = context
|
|
||||||
val static = createStaticFunctionWithReceivers(
|
val static = createStaticFunctionWithReceivers(
|
||||||
irFunction.parent,
|
irFunction.parent,
|
||||||
irFunction.name.toSuspendImplementationName(),
|
irFunction.name.toSuspendImplementationName(),
|
||||||
@@ -522,15 +521,10 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
it.putValueArgument(i++, irGet(irFunction.dispatchReceiverParameter!!))
|
it.putValueArgument(i++, irGet(irFunction.dispatchReceiverParameter!!))
|
||||||
}
|
}
|
||||||
if (irFunction.extensionReceiverParameter != null) {
|
if (irFunction.extensionReceiverParameter != null) {
|
||||||
val defaultValueForParameter = irFunction.extensionReceiverParameter!!.type.defaultValue(
|
it.putValueArgument(i++, irGet(irFunction.extensionReceiverParameter!!))
|
||||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext
|
|
||||||
)
|
|
||||||
it.putValueArgument(i++, defaultValueForParameter)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
for (parameter in irFunction.valueParameters) {
|
for (parameter in irFunction.valueParameters) {
|
||||||
val defaultValueForParameter = parameter.type.defaultValue(UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext)
|
it.putValueArgument(i++, irGet(parameter))
|
||||||
it.putValueArgument(i++, defaultValueForParameter)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -12,11 +12,11 @@ open class A(val v: String) {
|
|||||||
COROUTINE_SUSPENDED
|
COROUTINE_SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v)
|
open suspend fun suspendHere(x: String): String = suspendThere(x) + suspendThere(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
class B(v: String) : A(v) {
|
class B(v: String) : A(v) {
|
||||||
override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56")
|
override suspend fun suspendHere(x: String): String = super.suspendHere(x) + suspendThere("56")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend A.() -> Unit) {
|
fun builder(c: suspend A.() -> Unit) {
|
||||||
@@ -27,7 +27,7 @@ fun box(): String {
|
|||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
builder {
|
builder {
|
||||||
result = suspendHere()
|
result = suspendHere("O")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != "OK56") return "fail 1: $result"
|
if (result != "OK56") return "fail 1: $result"
|
||||||
|
|||||||
Reference in New Issue
Block a user