[descriptors] Move DeclarationDescriptor#findPackage helper to core

There is nothing serialization-specific about this function
This commit is contained in:
Sergej Jaskiewicz
2023-08-23 12:52:15 +02:00
committed by teamcity
parent dff2d2ed60
commit 5cb252fe49
7 changed files with 10 additions and 14 deletions
@@ -105,4 +105,9 @@ fun FunctionDescriptor.isTypedEqualsInValueClass(): Boolean {
fun FunctionDescriptor.overridesEqualsFromAny(): Boolean = name == OperatorNameConventions.EQUALS
&& valueParameters.size == 1 && valueParameters[0].type.isNullableAny()
&& contextReceiverParameters.isEmpty() && extensionReceiverParameter == null
&& contextReceiverParameters.isEmpty() && extensionReceiverParameter == null
tailrec fun DeclarationDescriptor.findPackage(): PackageFragmentDescriptor {
return if (this is PackageFragmentDescriptor) this
else this.containingDeclaration!!.findPackage()
}