From d337dff5fa237d68a726b8646e62fda9a2d3e3a2 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 19 Jan 2016 16:02:03 +0300 Subject: [PATCH] Minor --- .../resolve/lazy/FileScopeProviderImpl.kt | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt index 7faca36db6b..9759a6f3df4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt @@ -137,31 +137,6 @@ open class FileScopeProviderImpl( return FileData(lexicalScope, importResolver) } - // we use this dummy implementation of DeclarationDescriptor to check accessibility of symbols from the current package - private class DummyContainerDescriptor(private val file: KtFile, private val packageFragment: PackageFragmentDescriptor) : DeclarationDescriptorNonRoot { - private val sourceElement = KotlinSourceElement(file) - - override fun getContainingDeclaration() = packageFragment - - override fun getSource() = sourceElement - - override fun getOriginal() = this - override fun getAnnotations() = Annotations.EMPTY - override fun substitute(substitutor: TypeSubstitutor) = this - - override fun accept(visitor: DeclarationDescriptorVisitor?, data: D): R { - throw UnsupportedOperationException() - } - - override fun acceptVoid(visitor: DeclarationDescriptorVisitor?) { - throw UnsupportedOperationException() - } - - override fun getName(): Name { - throw UnsupportedOperationException() - } - } - private enum class FilteringKind { VISIBLE_CLASSES, INVISIBLE_CLASSES } @@ -197,6 +172,7 @@ open class FileScopeProviderImpl( } override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection { + // we do not perform any filtering by visibility here because all descriptors from both visible/invisible filter scopes are to be added anyway if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() return scope.getContributedDescriptors(kindFilter, { name -> name !in excludedNames && nameFilter(name) }) } @@ -208,4 +184,29 @@ open class FileScopeProviderImpl( } } } + + // we use this dummy implementation of DeclarationDescriptor to check accessibility of symbols from the current package + private class DummyContainerDescriptor(private val file: KtFile, private val packageFragment: PackageFragmentDescriptor) : DeclarationDescriptorNonRoot { + private val sourceElement = KotlinSourceElement(file) + + override fun getContainingDeclaration() = packageFragment + + override fun getSource() = sourceElement + + override fun getOriginal() = this + override fun getAnnotations() = Annotations.EMPTY + override fun substitute(substitutor: TypeSubstitutor) = this + + override fun accept(visitor: DeclarationDescriptorVisitor?, data: D): R { + throw UnsupportedOperationException() + } + + override fun acceptVoid(visitor: DeclarationDescriptorVisitor?) { + throw UnsupportedOperationException() + } + + override fun getName(): Name { + throw UnsupportedOperationException() + } + } }