[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:
committed by
Space Team
parent
29be88e3c9
commit
41976a2932
+1
-1
@@ -40,7 +40,7 @@ internal class KtFirSymbolProviderByJavaPsi(
|
||||
val classSymbol = getNamedClassSymbol(containingClass) ?: return null
|
||||
return with(analysisSession) {
|
||||
classSymbol.getDeclaredMemberScope()
|
||||
.getCallableSymbols { it == name }
|
||||
.getCallableSymbols(name)
|
||||
.firstOrNull { it.psi == callable }
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -56,15 +56,15 @@ internal object KDocReferenceResolver {
|
||||
.dropLast(1)
|
||||
.fold(initialScope) { currentScope, fqNamePart ->
|
||||
currentScope
|
||||
.getClassifierSymbols { it == fqNamePart }
|
||||
.getClassifierSymbols(fqNamePart)
|
||||
.mapNotNull { (it as? KtSymbolWithMembers)?.getDeclaredMemberScope() }
|
||||
.toList()
|
||||
.asCompositeScope()
|
||||
}
|
||||
|
||||
val shortName = fqName.shortName()
|
||||
addAll(scope.getCallableSymbols { it == shortName })
|
||||
addAll(scope.getClassifierSymbols { it == shortName })
|
||||
addAll(scope.getCallableSymbols(shortName))
|
||||
addAll(scope.getClassifierSymbols(shortName))
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
@@ -122,7 +122,7 @@ internal object KDocReferenceResolver {
|
||||
else -> {
|
||||
getClassOrObjectSymbolByClassId(classId)
|
||||
?.getDeclaredMemberScope()
|
||||
?.getCallableSymbols { it == callableId.callableName }
|
||||
?.getCallableSymbols(callableId.callableName)
|
||||
?.let(::addAll)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user