[JS IR] Remove filthy hacks from namer
This commit is contained in:
@@ -282,15 +282,7 @@ class NameTables(
|
||||
private fun generateNameForMemberFunction(declaration: IrSimpleFunction) {
|
||||
when (val signature = functionSignature(declaration)) {
|
||||
is StableNameSignature -> memberNames.declareStableName(signature, signature.name)
|
||||
is ParameterTypeBasedSignature -> {
|
||||
// TODO: Fix hack: Coroutines runtime currently relies on stable names
|
||||
// of `invoke` functions in FunctionN interfaces
|
||||
if (declaration.name.asString().startsWith("invoke")) {
|
||||
memberNames.declareStableName(signature, sanitizeName(signature.mangledName))
|
||||
} else {
|
||||
memberNames.declareFreshName(signature, signature.suggestedName)
|
||||
}
|
||||
}
|
||||
is ParameterTypeBasedSignature -> memberNames.declareFreshName(signature, signature.suggestedName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,11 +301,6 @@ class NameTables(
|
||||
val global: String? = globalNames.names[declaration]
|
||||
if (global != null) return global
|
||||
|
||||
if (declaration is IrTypeParameter) {
|
||||
// TODO: Fix type parameters
|
||||
return declaration.name.identifier
|
||||
}
|
||||
|
||||
var parent: IrDeclarationParent = declaration.parent
|
||||
while (parent is IrDeclaration) {
|
||||
val parentLocalNames = localNames[parent]
|
||||
@@ -325,7 +312,7 @@ class NameTables(
|
||||
parent = parent.parent
|
||||
}
|
||||
|
||||
return mappedNames[mapToKey(declaration)] ?: error("Can't find name for declaration ${declaration.fqNameWhenAvailable}")
|
||||
return mappedNames[mapToKey(declaration)] ?: error("Can't find name for declaration ${declaration.render()}")
|
||||
}
|
||||
|
||||
fun getNameForMemberField(field: IrField): String {
|
||||
@@ -347,11 +334,6 @@ class NameTables(
|
||||
val signature = functionSignature(function)
|
||||
val name = memberNames.names[signature] ?: mappedNames[mapToKey(signature)]
|
||||
|
||||
// TODO: Fix hack: Coroutines runtime currently relies on stable names
|
||||
// of `invoke` functions in FunctionN interfaces
|
||||
if (name == null && signature is ParameterTypeBasedSignature && signature.suggestedName.startsWith("invoke"))
|
||||
return signature.suggestedName
|
||||
|
||||
// TODO Add a compiler flag, which enables this behaviour
|
||||
// TODO remove in DCE
|
||||
if (name == null) {
|
||||
|
||||
Reference in New Issue
Block a user