[IR] Remove methods for computing full mangled names from non-IR manglers
A full mangled name of a declaration is a mangled name that includes the mangled names of all the declaration's parents. We don't use full mangled names for building `IdSignature`s. We use them in two places: - Generating stable names for JavaScript functions in Kotlin/JS (see `NameTables.kt`) - Generating names for LLVM symbols from lowered IR functions in Kotlin/Native (see `BinaryInterface.kt`) In both of these places we run the IR mangler, hence we don't need this functionality in other manglers.
This commit is contained in:
committed by
Space Team
parent
69aeddcba8
commit
47f8dedfa5
-6
@@ -61,8 +61,6 @@ class ManglerChecker(
|
||||
private fun IrDeclaration.shouldBeSkipped(): Boolean = accept(skipper, null)
|
||||
private fun KotlinMangler<IrDeclaration>.isExportCheck(declaration: IrDeclaration) =
|
||||
!declaration.shouldBeSkipped() && declaration.isExported(false)
|
||||
private fun KotlinMangler<IrDeclaration>.stringMangle(declaration: IrDeclaration) =
|
||||
declaration.mangleString(compatibleMode = false)
|
||||
|
||||
private fun KotlinMangler<IrDeclaration>.signatureMangle(declaration: IrDeclaration) =
|
||||
declaration.signatureString(compatibleMode = false)
|
||||
@@ -99,10 +97,6 @@ class ManglerChecker(
|
||||
|
||||
if (!exported) return
|
||||
|
||||
manglers.checkAllEqual("", { stringMangle(declaration) }) { m1, r1, m2, r2 ->
|
||||
error("FULL: ${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
|
||||
}
|
||||
|
||||
manglers.checkAllEqual("", { signatureMangle(declaration) }) { m1, r1, m2, r2 ->
|
||||
error("SIG: ${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
|
||||
}
|
||||
|
||||
+1
-11
@@ -19,12 +19,6 @@ abstract class DescriptorBasedKotlinManglerImpl : AbstractKotlinMangler<Declarat
|
||||
private fun withMode(mode: MangleMode, compatibleMode: Boolean, descriptor: DeclarationDescriptor): String =
|
||||
getMangleComputer(mode, compatibleMode).computeMangle(descriptor)
|
||||
|
||||
override fun ClassDescriptor.mangleEnumEntryString(compatibleMode: Boolean): String = withMode(MangleMode.FQNAME, compatibleMode, this)
|
||||
|
||||
override fun PropertyDescriptor.mangleFieldString(compatibleMode: Boolean): String = mangleString(compatibleMode)
|
||||
|
||||
override fun DeclarationDescriptor.mangleString(compatibleMode: Boolean): String = withMode(MangleMode.FULL, compatibleMode, this)
|
||||
|
||||
override fun DeclarationDescriptor.signatureString(compatibleMode: Boolean): String = withMode(MangleMode.SIGNATURE, compatibleMode, this)
|
||||
|
||||
override fun DeclarationDescriptor.isExported(compatibleMode: Boolean): Boolean = getExportChecker(compatibleMode).check(this, SpecialDeclarationType.REGULAR)
|
||||
@@ -40,11 +34,7 @@ class Ir2DescriptorManglerAdapter(private val delegate: DescriptorBasedKotlinMan
|
||||
}
|
||||
|
||||
override fun IrDeclaration.mangleString(compatibleMode: Boolean): String {
|
||||
return when (this) {
|
||||
is IrEnumEntry -> delegate.run { descriptor.mangleEnumEntryString(compatibleMode) }
|
||||
is IrField -> delegate.run { descriptor.mangleFieldString(compatibleMode) }
|
||||
else -> delegate.run { descriptor.mangleString(compatibleMode) }
|
||||
}
|
||||
error("Should not be called")
|
||||
}
|
||||
|
||||
override fun IrDeclaration.signatureString(compatibleMode: Boolean): String = delegate.run { descriptor.signatureString(compatibleMode) }
|
||||
|
||||
Reference in New Issue
Block a user