IR, JS: remove duplicate FQ name check from hasEqualFqName

`hasEqualFqName` is called from `hasAnnotation`, which takes more than
1% of total backend time, so it's important to avoid doing extra work
here.

It seems to be a quirk of the JS IR backend specifically that
`JsExport.Ignore` has incorrect IR parent structure here; for all other
backends, checking FQ name by traversing IR parents should work fine.

 #KT-66281
This commit is contained in:
Alexander Udalov
2024-03-05 00:07:55 +01:00
committed by Space Team
parent d430673320
commit 47a4ee7fdf
2 changed files with 6 additions and 2 deletions
@@ -140,7 +140,7 @@ val IrClass.packageFqName: FqName?
get() = symbol.signature?.packageFqName() ?: parent.getPackageFragment()?.packageFqName
fun IrDeclarationWithName.hasEqualFqName(fqName: FqName): Boolean =
symbol.hasEqualFqName(fqName) || name == fqName.shortName() && when (val parent = parent) {
name == fqName.shortName() && when (val parent = parent) {
is IrPackageFragment -> parent.packageFqName == fqName.parent()
is IrDeclarationWithName -> parent.hasEqualFqName(fqName.parent())
else -> false