[JS IR] Fix access to coroutine empty context for suspend main

This commit is contained in:
Roman Artemev
2020-01-27 15:42:19 +03:00
committed by romanart
parent cef9ed1dae
commit 7688197841
2 changed files with 2 additions and 2 deletions
@@ -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() {
@@ -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