Optimize contributedDescriptors

Take kindFilters into account on early stage.

#KTIJ-23032
This commit is contained in:
Vladimir Dolzhenko
2022-09-26 16:32:16 +02:00
committed by teamcity
parent c198d4d90d
commit a32c660a67
@@ -67,9 +67,15 @@ class LazyExplicitImportScope(
): Collection<DeclarationDescriptor> {
val descriptors = SmartList<DeclarationDescriptor>()
descriptors.addIfNotNull(getContributedClassifier(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
descriptors.addAll(getContributedFunctions(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
descriptors.addAll(getContributedVariables(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
if (kindFilter.acceptsKinds(DescriptorKindFilter.CLASSIFIERS_MASK)) {
descriptors.addIfNotNull(getContributedClassifier(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
}
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) {
descriptors.addAll(getContributedFunctions(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
}
if (kindFilter.acceptsKinds(DescriptorKindFilter.VARIABLES_MASK)) {
descriptors.addAll(getContributedVariables(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
}
if (changeNamesForAliased && aliasName != declaredName) {
for (i in descriptors.indices) {