More efficient getting of top-level callables

This commit is contained in:
Valentin Kipyatkov
2015-11-06 13:33:32 +03:00
parent ae9482a36c
commit 5d56339aba
2 changed files with 28 additions and 23 deletions
@@ -158,7 +158,7 @@ abstract class CompletionSession(
protected fun indicesHelper(mayIncludeInaccessible: Boolean): KotlinIndicesHelper {
val filter = if (mayIncludeInaccessible) isVisibleFilter else isVisibleFilterCheckAlways
return KotlinIndicesHelper(resolutionFacade, searchScope, filter, visibilityFilterMayIncludeAccessible = mayIncludeInaccessible)
return KotlinIndicesHelper(resolutionFacade, searchScope, filter, filterOutPrivate = !mayIncludeInaccessible)
}
protected val toFromOriginalFileMapper: ToFromOriginalFileMapper
@@ -394,9 +394,10 @@ abstract class CompletionSession(
return callTypeAndReceiver.receiver == null
}
protected fun getTopLevelCallables(): Collection<DeclarationDescriptor> {
return indicesHelper(true).getTopLevelCallables({ prefixMatcher.prefixMatches(it) })
.filterShadowedNonImported()
protected fun getTopLevelCallables(): Collection<CallableDescriptor> {
val result = LinkedHashSet<CallableDescriptor>()
indicesHelper(true).processTopLevelCallables({ prefixMatcher.prefixMatches(it) }) { result.add(it) }
return result.filterShadowedNonImported()
}
protected fun CallTypeAndReceiver<*, *>.shouldCompleteCallableExtensions(): Boolean {