[Analysis API] optimize scope members processing when a candidate name set is known

Use KtScope.getCallableSymbols/getClassifier symbols overloads which accept a candidate name set.

^KT-58653
This commit is contained in:
Ilya Kirillov
2023-05-12 11:23:30 +02:00
committed by Space Team
parent 29be88e3c9
commit 41976a2932
5 changed files with 8 additions and 9 deletions
@@ -197,7 +197,7 @@ internal open class SymbolLightClassForClassOrObject : SymbolLightClassForNamedC
// Compiler will generate 'equals/hashCode/toString' for data class if they are not final.
// We want to mimic that.
val nonFinalFunctionsFromAny = classOrObjectSymbol.getMemberScope()
.getCallableSymbols { name -> name.isFromAny }
.getCallableSymbols(EQUALS, HASHCODE_NAME, TO_STRING)
.filterIsInstance<KtFunctionSymbol>()
.filterNot {
it.modality == Modality.FINAL || (it.getContainingSymbol() as? KtNamedClassOrObjectSymbol)?.modality == Modality.FINAL
@@ -66,7 +66,7 @@ internal class SymbolLightClassForInlineClass : SymbolLightClassForClassOrObject
?.singleOrNull()
if (inlineClassParameterSymbol != null) {
val propertySymbol = declaredMemberScope.getCallableSymbols { it == inlineClassParameterSymbol.name }
val propertySymbol = declaredMemberScope.getCallableSymbols(inlineClassParameterSymbol.name)
.singleOrNull { it is KtPropertySymbol && it.isFromPrimaryConstructor } as? KtPropertySymbol
if (propertySymbol != null) {