From f4c1e52338800668aa0ab470aa3f6fa0a5c56d79 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 29 Oct 2020 17:52:35 +0300 Subject: [PATCH] [JS IR] Continuation parameter in main through accessor ^KT-43222 fixed --- .../js/transformers/irToJs/IrModuleToJsTransformer.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt index 386ead86929de..828f6b33f9333 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrModuleToJsTransformer.kt @@ -303,8 +303,10 @@ class IrModuleToJsTransformer( if (mainFunction.valueParameters.isNotEmpty()) JsArrayLiteral(mainArguments.map { JsStringLiteral(it) }) else null val continuation = if (mainFunction.isSuspend) { - val emptyContinuationField = backendContext.coroutineEmptyContinuation.owner.backingField!! - rootContext.getNameForField(emptyContinuationField).makeRef() + backendContext.coroutineEmptyContinuation.owner + .let { it.getter!! } + .let { rootContext.getNameForStaticFunction(it) } + .let { JsInvocation(it.makeRef()) } } else null return listOfNotNull(mainArgumentsArray, continuation)