diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt index fe6f59293cc..ffb5425cc81 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt @@ -27,24 +27,6 @@ import java.util.* import kotlin.collections.set import kotlin.math.abs -// TODO remove direct usages of [mapToKey] from [NameTable] & co and move it to scripting & REPL infrastructure. Review usages. -private fun mapToKey(declaration: T): String { - return with(JsManglerIr) { - if (declaration is IrDeclaration) { - try { - declaration.hashedMangle(compatibleMode = false).toString() - } catch (e: Throwable) { - // FIXME: We can't mangle some local declarations. But - "wrong_key" - } - } else if (declaration is String) { - declaration.hashMangle.toString() - } else { - error("Key is not generated for " + declaration?.let { it::class.simpleName }) - } - } -} - abstract class NameScope { abstract fun isReserved(name: String): Boolean @@ -56,7 +38,6 @@ abstract class NameScope { class NameTable( val parent: NameScope = EmptyScope, val reserved: MutableSet = mutableSetOf(), - val mappedNames: MutableMap? = null, ) : NameScope() { val names = mutableMapOf() @@ -69,7 +50,6 @@ class NameTable( fun declareStableName(declaration: T, name: String) { names[declaration] = name reserved.add(name) - mappedNames?.set(mapToKey(declaration), name) } fun declareFreshName(declaration: T, suggestedName: String): String { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinMangler.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinMangler.kt index 8aca76934c4..7bcee62ca49 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinMangler.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinMangler.kt @@ -72,7 +72,7 @@ interface KotlinMangler { * (depending on the target platform). * * The result of this function is only used for assigning names to binary symbols of Kotlin functions in the final executable - * produced by Kotlin/Native, and for generating stable names in the JavaScript code produced by Kotlin/JS. + * produced by Kotlin/Native. * **It does not affect klib ABI.** * * @param compatibleMode If `true`, the mangled names of property backing fields are just those fields' names. @@ -80,16 +80,6 @@ interface KotlinMangler { */ fun IrDeclaration.mangleString(compatibleMode: Boolean): String - /** - * Computes the hash code of the string returned by [mangleString] using the CityHash64 algorithm. - * - * **The result of this function does not affect klib ABI.** - * - * @param compatibleMode If `true`, the mangled names of property backing fields are just those fields' names. - * Otherwise, mangles such fields exactly as their corresponding properties. - */ - fun IrDeclaration.hashedMangle(compatibleMode: Boolean): Long = mangleString(compatibleMode).hashMangle - override val manglerName: String get() = "Ir" }