JVM_IR: actually forward the parameters to $suspendImpl

This commit is contained in:
pyos
2020-01-14 11:01:02 +01:00
committed by Ilmir Usmanov
parent 54285d328f
commit f73891af98
2 changed files with 5 additions and 11 deletions
@@ -502,7 +502,6 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
private fun createStaticSuspendImpl(irFunction: IrSimpleFunction): IrSimpleFunction {
// Create static suspend impl method.
val backendContext = context
val static = createStaticFunctionWithReceivers(
irFunction.parent,
irFunction.name.toSuspendImplementationName(),
@@ -522,15 +521,10 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
it.putValueArgument(i++, irGet(irFunction.dispatchReceiverParameter!!))
}
if (irFunction.extensionReceiverParameter != null) {
val defaultValueForParameter = irFunction.extensionReceiverParameter!!.type.defaultValue(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext
)
it.putValueArgument(i++, defaultValueForParameter)
it.putValueArgument(i++, irGet(irFunction.extensionReceiverParameter!!))
}
for (parameter in irFunction.valueParameters) {
val defaultValueForParameter = parameter.type.defaultValue(UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext)
it.putValueArgument(i++, defaultValueForParameter)
it.putValueArgument(i++, irGet(parameter))
}
})
}
@@ -12,11 +12,11 @@ open class A(val v: String) {
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) {
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) {
@@ -27,7 +27,7 @@ fun box(): String {
var result = ""
builder {
result = suspendHere()
result = suspendHere("O")
}
if (result != "OK56") return "fail 1: $result"