[JS IR] Not export fun with stable name and default argument

if it is not exported, but just with stable name

^KT-50464 fixed

Merge-request: KT-MR-5324
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
This commit is contained in:
Ilya Goncharov
2021-12-23 15:21:00 +00:00
committed by Space
parent 61e0375900
commit 52ccf3d6ec
2 changed files with 7 additions and 2 deletions
@@ -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)
@@ -30,6 +30,9 @@ class Class
external interface ExternalInterface
@JsName("bbb")
fun zzz(x: Int = 10) {}
// FILE: file2.kt
@file:JsExport