From bc9828f3f3293d33c7f2cbc110901bdb0f566b3e Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 8 Dec 2020 01:01:59 +0300 Subject: [PATCH] [JS IR] Generate a key using hashedMangle for all IR declarations in mapToKey It is required to avoid "key" clashes and failing with ISE. --- .../org/jetbrains/kotlin/ir/backend/js/utils/NameTables.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 4c7b1370dbb..ee950a66aa4 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 @@ -29,7 +29,7 @@ import java.util.* // 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 && isPublic(declaration)) { + if (declaration is IrDeclaration) { declaration.hashedMangle.toString() } else if (declaration is Signature) { declaration.toString().hashMangle.toString() @@ -39,9 +39,6 @@ private fun mapToKey(declaration: T): String { } } -private fun JsManglerIr.isPublic(declaration: IrDeclaration) = - declaration.isExported() && declaration !is IrScript && declaration !is IrVariable && declaration !is IrValueParameter - class NameTable( val parent: NameTable<*>? = null, val reserved: MutableSet = mutableSetOf(),