[JS IR] Generate a key using hashedMangle for all IR declarations in mapToKey
It is required to avoid "key" clashes and failing with ISE.
This commit is contained in:
@@ -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 <T> 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 <T> mapToKey(declaration: T): String {
|
||||
}
|
||||
}
|
||||
|
||||
private fun JsManglerIr.isPublic(declaration: IrDeclaration) =
|
||||
declaration.isExported() && declaration !is IrScript && declaration !is IrVariable && declaration !is IrValueParameter
|
||||
|
||||
class NameTable<T>(
|
||||
val parent: NameTable<*>? = null,
|
||||
val reserved: MutableSet<String> = mutableSetOf(),
|
||||
|
||||
Reference in New Issue
Block a user