[JS IR] Use recursive isExported for stable name detection
^KT-44469 fixed
This commit is contained in:
+4
-4
@@ -391,11 +391,11 @@ private fun getExportCandidate(declaration: IrDeclaration): IrDeclarationWithNam
|
|||||||
return declaration
|
return declaration
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, context: JsIrBackendContext): Boolean {
|
private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, context: JsIrBackendContext?): Boolean {
|
||||||
if (declaration.fqNameWhenAvailable in context.additionalExportedDeclarationNames)
|
if (context?.additionalExportedDeclarationNames?.contains(declaration.fqNameWhenAvailable) == true)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
if (declaration in context.additionalExportedDeclarations)
|
if (context?.additionalExportedDeclarations?.contains(declaration) == true)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
if (declaration.isJsExport())
|
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
|
val candidate = getExportCandidate(this) ?: return false
|
||||||
return shouldDeclarationBeExported(candidate, context)
|
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.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin
|
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.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||||
@@ -51,7 +52,7 @@ fun IrFunction.hasStableJsName(): Boolean {
|
|||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isEffectivelyExternal() || getJsName() != null || isJsExport() || parentClassOrNull?.isJsExport() == true) && namedOrMissingGetter
|
return (isEffectivelyExternal() || getJsName() != null || isExported(null)) && namedOrMissingGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrFunction.isEqualsInheritedFromAny() =
|
fun IrFunction.isEqualsInheritedFromAny() =
|
||||||
|
|||||||
Reference in New Issue
Block a user