diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ExportedDefaultParameterStub.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ExportedDefaultParameterStub.kt index 6b806fc98c5..76172115acf 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ExportedDefaultParameterStub.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ExportedDefaultParameterStub.kt @@ -15,11 +15,11 @@ import org.jetbrains.kotlin.backend.common.lower.irBlockBody import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin +import org.jetbrains.kotlin.ir.backend.js.export.isExported import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.backend.js.utils.JsAnnotations import org.jetbrains.kotlin.ir.backend.js.utils.hasStableJsName import org.jetbrains.kotlin.ir.builders.* -import org.jetbrains.kotlin.ir.builders.declarations.addFunction import org.jetbrains.kotlin.ir.builders.declarations.buildFun import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrConstructorCall @@ -105,7 +105,9 @@ class ExportedDefaultParameterStub(val context: JsIrBackendContext) : Declaratio origin = JsIrBuilder.SYNTHESIZED_DECLARATION } - context.additionalExportedDeclarations.add(exportedDefaultStubFun) + if (declaration.isExported(context)) { + context.additionalExportedDeclarations.add(exportedDefaultStubFun) + } exportedDefaultStubFun.parent = declaration.parent exportedDefaultStubFun.copyParameterDeclarationsFrom(declaration) diff --git a/js/js.translator/testData/typescript-export/selectiveExport/selectiveExport.kt b/js/js.translator/testData/typescript-export/selectiveExport/selectiveExport.kt index 8d6050d2834..61f9fb7f518 100644 --- a/js/js.translator/testData/typescript-export/selectiveExport/selectiveExport.kt +++ b/js/js.translator/testData/typescript-export/selectiveExport/selectiveExport.kt @@ -30,6 +30,9 @@ class Class external interface ExternalInterface +@JsName("bbb") +fun zzz(x: Int = 10) {} + // FILE: file2.kt @file:JsExport