[IR SERIALIZATION] Cleanup mangler interface
This commit is contained in:
+4
-2
@@ -45,11 +45,13 @@ abstract class GlobalDeclarationTable(private val mangler: KotlinMangler, privat
|
||||
|
||||
open fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
|
||||
return table.getOrPut(declaration) {
|
||||
UniqId(mangler.hashedMangleImpl(declaration), false).also { clashTracker.commit(declaration, it) }
|
||||
with(mangler) {
|
||||
UniqId(declaration.hashedMangle, false).also { clashTracker.commit(declaration, it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun isExportedDeclaration(declaration: IrDeclaration): Boolean = mangler.isExportedImpl(declaration)
|
||||
fun isExportedDeclaration(declaration: IrDeclaration): Boolean = with(mangler) { declaration.isExported() }
|
||||
}
|
||||
|
||||
class DeclarationTable(
|
||||
|
||||
+2
-4
@@ -16,9 +16,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
interface KotlinMangler {
|
||||
val String.hashMangle: Long
|
||||
val IrDeclaration.hashedMangle: Long
|
||||
fun hashedMangleImpl(declaration: IrDeclaration): Long
|
||||
fun IrDeclaration.isExported(): Boolean
|
||||
fun isExportedImpl(declaration: IrDeclaration): Boolean
|
||||
val IrFunction.functionName: String
|
||||
val IrType.isInlined: Boolean
|
||||
val Long.isSpecial: Boolean
|
||||
@@ -33,7 +31,7 @@ interface KotlinMangler {
|
||||
abstract class KotlinManglerImpl : KotlinMangler {
|
||||
override val String.hashMangle get() = this.cityHash64()
|
||||
|
||||
override fun hashedMangleImpl(declaration: IrDeclaration): Long {
|
||||
private fun hashedMangleImpl(declaration: IrDeclaration): Long {
|
||||
return declaration.uniqSymbolName().hashMangle
|
||||
}
|
||||
|
||||
@@ -54,7 +52,7 @@ abstract class KotlinManglerImpl : KotlinMangler {
|
||||
* that doesn't depend on any internal transformations (e.g. IR lowering),
|
||||
* and so should be computable from the descriptor itself without checking a backend state.
|
||||
*/
|
||||
tailrec override fun isExportedImpl(declaration: IrDeclaration): Boolean {
|
||||
private tailrec fun isExportedImpl(declaration: IrDeclaration): Boolean {
|
||||
// TODO: revise
|
||||
val descriptorAnnotations = declaration.descriptor.annotations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user