Made private things private

This commit is contained in:
Valentin Kipyatkov
2014-11-07 22:35:03 +03:00
parent 6729a72ef8
commit bf38da7bb1
@@ -44,28 +44,25 @@ public abstract class DeclarationProviderFactoryService {
filesScope: GlobalSearchScope filesScope: GlobalSearchScope
): DeclarationProviderFactory { ): DeclarationProviderFactory {
return ServiceManager.getService(project, javaClass<DeclarationProviderFactoryService>())!! return ServiceManager.getService(project, javaClass<DeclarationProviderFactoryService>())!!
.create(project, storageManager, syntheticFiles, SyntheticFilesFilteringScope.filter(syntheticFiles, filesScope)) .create(project, storageManager, syntheticFiles, filteringScope(syntheticFiles, filesScope))
} }
} private fun filteringScope(syntheticFiles: Collection<JetFile>, baseScope: GlobalSearchScope): GlobalSearchScope {
class SyntheticFilesFilteringScope(syntheticFiles: Collection<JetFile>, baseScope: GlobalSearchScope) :
DelegatingGlobalSearchScope(baseScope) {
val originals = syntheticFiles.map {
it.getOriginalFile().getVirtualFile()
}.filterNotNullTo(HashSet<VirtualFile>())
override fun contains(file: VirtualFile): Boolean {
return super.contains(file) && file !in originals
}
class object {
fun filter(syntheticFiles: Collection<JetFile>, baseScope: GlobalSearchScope): GlobalSearchScope {
if (syntheticFiles.isEmpty()) { if (syntheticFiles.isEmpty()) {
return baseScope return baseScope
} }
return SyntheticFilesFilteringScope(syntheticFiles, baseScope) return SyntheticFilesFilteringScope(syntheticFiles, baseScope)
} }
} }
private class SyntheticFilesFilteringScope(syntheticFiles: Collection<JetFile>, baseScope: GlobalSearchScope)
: DelegatingGlobalSearchScope(baseScope) {
private val originals = syntheticFiles
.map { it.getOriginalFile().getVirtualFile() }
.filterNotNullTo(HashSet<VirtualFile>())
override fun contains(file: VirtualFile) = super.contains(file) && file !in originals
} }
} }