diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionCallsLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionCallsLowering.kt index 2ccda86fca1..bf76f5e4eac 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionCallsLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionCallsLowering.kt @@ -62,9 +62,8 @@ class AddContinuationToFunctionCallsLowering(val context: JsCommonBackendContext } val oldFun = expression.symbol.owner - val newFun: IrSimpleFunction = - context.mapping.suspendFunctionsToFunctionWithContinuations[oldFun] - ?: error("No mapping for ${oldFun.fqNameWhenAvailable}") + // TODO: investigate why mapping might be unavailable for SuspendFunction4.invoke + val newFun: IrSimpleFunction = oldFun.getOrCreateFunctionWithContinuationStub(context) return irCall( expression, diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionsLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionsLowering.kt index 447977e2d96..063513334f7 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionsLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/coroutines/AddContinuationToFunctionsLowering.kt @@ -85,7 +85,7 @@ private fun transformSuspendFunction(context: JsCommonBackendContext, function: } -private fun IrSimpleFunction.getOrCreateFunctionWithContinuationStub(context: JsCommonBackendContext): IrSimpleFunction { +fun IrSimpleFunction.getOrCreateFunctionWithContinuationStub(context: JsCommonBackendContext): IrSimpleFunction { return context.mapping.suspendFunctionsToFunctionWithContinuations.getOrPut(this) { createSuspendFunctionStub(context) }