No filtering by visibility filter twice

This commit is contained in:
Valentin Kipyatkov
2014-10-22 13:54:01 +04:00
parent 1f548875c6
commit 0384e3d323
@@ -129,7 +129,7 @@ public class KotlinIndicesHelper(private val project: Project,
return allFqNames.filter { nameFilter(it.shortName().asString()) } return allFqNames.filter { nameFilter(it.shortName().asString()) }
.toSet() .toSet()
.flatMap { findTopLevelCallables(it, context, jetScope) } .flatMap { findTopLevelCallables(it, context, jetScope).filter(visibilityFilter) }
} }
public fun getCallableExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> { public fun getCallableExtensions(nameFilter: (String) -> Boolean, expression: JetSimpleNameExpression): Collection<CallableDescriptor> {
@@ -213,7 +213,7 @@ public class KotlinIndicesHelper(private val project: Project,
private fun findTopLevelCallables(fqName: FqName, context: JetExpression, jetScope: JetScope): Collection<CallableDescriptor> { private fun findTopLevelCallables(fqName: FqName, context: JetExpression, jetScope: JetScope): Collection<CallableDescriptor> {
val importDirective = JetPsiFactory(context.getProject()).createImportDirective(ImportPath(fqName, false)) val importDirective = JetPsiFactory(context.getProject()).createImportDirective(ImportPath(fqName, false))
val allDescriptors = analyzeImportReference(importDirective, jetScope, BindingTraceContext(), resolveSession.getModuleDescriptor()) val allDescriptors = analyzeImportReference(importDirective, jetScope, BindingTraceContext(), resolveSession.getModuleDescriptor())
return allDescriptors.filterIsInstance(javaClass<CallableDescriptor>()).filter { it.getExtensionReceiverParameter() == null && visibilityFilter(it) } return allDescriptors.filterIsInstance(javaClass<CallableDescriptor>()).filter { it.getExtensionReceiverParameter() == null }
} }
private fun analyzeImportReference( private fun analyzeImportReference(