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 55fe1f92890..ad528e344ee 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 @@ -243,6 +243,14 @@ class JsIrBackendContext( override val functionAdapter: IrClassSymbol get() = TODO("Not implemented") + + override fun functionN(n: Int): IrClassSymbol { + return irFactory.stageController.withInitialIr { super.functionN(n) } + } + + override fun suspendFunctionN(n: Int): IrClassSymbol { + return irFactory.stageController.withInitialIr { super.suspendFunctionN(n) } + } } override fun unfoldInlineClassType(irType: IrType): IrType? { diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/WholeWorldStageController.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/WholeWorldStageController.kt index cbd061f963a..e2010973035 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/WholeWorldStageController.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/WholeWorldStageController.kt @@ -44,10 +44,13 @@ class WholeWorldStageController : StageController() { override fun withStage(stage: Int, fn: () -> T): T { val oldStage = currentStage currentStage = stage + val oldCurrentDeclaration = currentDeclaration + currentDeclaration = null return try { fn() } finally { currentStage = oldStage + currentDeclaration = oldCurrentDeclaration } }