From 76881978414b0632469e7ae465108b75295a9cd0 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Mon, 27 Jan 2020 15:42:19 +0300 Subject: [PATCH] [JS IR] Fix access to coroutine empty context for suspend main --- .../org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt | 2 +- .../backend/js/transformers/irToJs/IrModuleToJsTransformer.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt index 0f25f6edd64..24a57d30b76 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsIrBackendContext.kt @@ -264,7 +264,7 @@ class JsIrBackendContext( val coroutineGetContextJs get() = ir.symbols.coroutineGetContext - val coroutineEmptyContinuation = symbolTable.referenceField(getProperty(FqName.fromSegments(listOf("kotlin", "coroutines", "js", "internal", "EmptyContinuation")))) + val coroutineEmptyContinuation = symbolTable.referenceProperty(getProperty(FqName.fromSegments(listOf("kotlin", "coroutines", "js", "internal", "EmptyContinuation")))) val coroutineContextProperty: PropertyDescriptor get() { 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 1d052f2b96b..b3f647b6439 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 @@ -185,7 +185,7 @@ class IrModuleToJsTransformer( if (mainFunction.valueParameters.isNotEmpty()) JsArrayLiteral(mainArguments.map { JsStringLiteral(it) }) else null val continuation = if (mainFunction.isSuspend) { - val emptyContinuationField = backendContext.coroutineEmptyContinuation.owner + val emptyContinuationField = backendContext.coroutineEmptyContinuation.owner.backingField!! rootContext.getNameForField(emptyContinuationField).makeRef() } else null