No use of "by ..Scope.Empty"
This commit is contained in:
@@ -21,11 +21,11 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.BaseImportingScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.ImportingScope
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
class AllUnderImportsScope(descriptor: DeclarationDescriptor) : ImportingScope by ImportingScope.Empty {
|
||||
class AllUnderImportsScope(descriptor: DeclarationDescriptor) : BaseImportingScope(null) {
|
||||
private val scopes = if (descriptor is ClassDescriptor) {
|
||||
listOf(descriptor.staticScope, descriptor.unsubstitutedInnerClassesScope)
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ package org.jetbrains.kotlin.resolve
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.BaseImportingScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.ImportingScope
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
class SingleImportScope(private val aliasName: Name, private val descriptors: Collection<DeclarationDescriptor>) : ImportingScope by ImportingScope.Empty {
|
||||
class SingleImportScope(private val aliasName: Name, private val descriptors: Collection<DeclarationDescriptor>) : BaseImportingScope(null) {
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation)
|
||||
= if (name == aliasName) descriptors.filterIsInstance<ClassifierDescriptor>().singleOrNull() else null
|
||||
|
||||
|
||||
@@ -29,15 +29,17 @@ import org.jetbrains.kotlin.resolve.NoSubpackagesInPackageScope
|
||||
import org.jetbrains.kotlin.resolve.QualifiedExpressionResolver
|
||||
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.BaseLexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.ImportingScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.withParent
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.storage.getValue
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
public class FileScopeProviderImpl(
|
||||
public open class FileScopeProviderImpl(
|
||||
private val topLevelDescriptorProvider: TopLevelDescriptorProvider,
|
||||
private val storageManager: StorageManager,
|
||||
private val moduleDescriptor: ModuleDescriptor,
|
||||
@@ -108,12 +110,13 @@ public class FileScopeProviderImpl(
|
||||
|
||||
scope = LazyImportScope(scope, packageFragment, aliasImportResolver, LazyImportScope.FilteringKind.ALL, "Alias imports in $debugName")
|
||||
|
||||
val lexicalScope = object : LexicalScope by LexicalScope.Empty {
|
||||
override val parent: LexicalScope?
|
||||
get() = scope
|
||||
|
||||
val lexicalScope = object : BaseLexicalScope(scope) {
|
||||
override val ownerDescriptor: DeclarationDescriptor
|
||||
get() = packageFragment
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println("File top-level scope (empty)")
|
||||
}
|
||||
}
|
||||
|
||||
bindingTrace.recordScope(lexicalScope, file)
|
||||
|
||||
@@ -327,7 +327,7 @@ fun ImportingScope.withParent(newParent: ImportingScope?): ImportingScope {
|
||||
|
||||
fun LexicalScope.replaceImportingScopes(importingScopeChain: ImportingScope?): LexicalScope {
|
||||
return if (this is ImportingScope)
|
||||
importingScopeChain ?: LexicalScope.Empty
|
||||
importingScopeChain ?: ImportingScope.Empty
|
||||
else
|
||||
LexicalScopeWrapper(this, importingScopeChain)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user