mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-25 08:31:27 +00:00
[JS IR] Use recursive isExported for stable name detection
^KT-44469 fixed
This commit is contained in:
@@ -391,11 +391,11 @@ private fun getExportCandidate(declaration: IrDeclaration): IrDeclarationWithNam
|
||||
return declaration
|
||||
}
|
||||
|
||||
private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, context: JsIrBackendContext): Boolean {
|
||||
if (declaration.fqNameWhenAvailable in context.additionalExportedDeclarationNames)
|
||||
private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, context: JsIrBackendContext?): Boolean {
|
||||
if (context?.additionalExportedDeclarationNames?.contains(declaration.fqNameWhenAvailable) == true)
|
||||
return true
|
||||
|
||||
if (declaration in context.additionalExportedDeclarations)
|
||||
if (context?.additionalExportedDeclarations?.contains(declaration) == true)
|
||||
return true
|
||||
|
||||
if (declaration.isJsExport())
|
||||
@@ -408,7 +408,7 @@ private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, cont
|
||||
}
|
||||
}
|
||||
|
||||
fun IrDeclaration.isExported(context: JsIrBackendContext): Boolean {
|
||||
fun IrDeclaration.isExported(context: JsIrBackendContext?): Boolean {
|
||||
val candidate = getExportCandidate(this) ?: return false
|
||||
return shouldDeclarationBeExported(candidate, context)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.IrElement
|
||||
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.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||
@@ -51,7 +52,7 @@ fun IrFunction.hasStableJsName(): Boolean {
|
||||
else -> true
|
||||
}
|
||||
|
||||
return (isEffectivelyExternal() || getJsName() != null || isJsExport() || parentClassOrNull?.isJsExport() == true) && namedOrMissingGetter
|
||||
return (isEffectivelyExternal() || getJsName() != null || isExported(null)) && namedOrMissingGetter
|
||||
}
|
||||
|
||||
fun IrFunction.isEqualsInheritedFromAny() =
|
||||
|
||||
Reference in New Issue
Block a user