Removed MemberScope.getPackage

This commit is contained in:
Stanislav Erokhin
2015-12-01 11:44:15 +03:00
parent 846fb397c4
commit 8807cd828f
20 changed files with 47 additions and 87 deletions
@@ -619,8 +619,5 @@ public class LazyJavaClassMemberScope(
}
}
// namespaces should be resolved elsewhere
override fun getPackage(name: Name) = null
override fun toString() = "Lazy java member scope for " + jClass.getFqName()
}
@@ -29,9 +29,6 @@ public abstract class LazyJavaStaticScope(c: LazyJavaResolverContext) : LazyJava
override fun getDispatchReceiverParameter() = null
// Package fragments are not nested
override fun getPackage(name: Name) = null
abstract fun getSubPackages(): Collection<FqName>
override fun resolveMethodSignature(
@@ -44,6 +44,7 @@ public class LazyPackageViewDescriptorImpl(
MemberScope.Empty
}
else {
// Packages from SubpackagesScope are got via getContributedDescriptors(DescriptorKindFilter.PACKAGES, MemberScope.ALL_NAME_FILTER)
val scopes = fragments.map { it.getMemberScope() } + SubpackagesScope(module, fqName)
ChainedScope("package view scope for $fqName in ${module.getName()}", *scopes.toTypedArray())
}
@@ -28,9 +28,9 @@ import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.addIfNotNull
import java.util.*
public class SubpackagesScope(private val moduleDescriptor: ModuleDescriptor, private val fqName: FqName) : MemberScopeImpl() {
public open class SubpackagesScope(private val moduleDescriptor: ModuleDescriptor, private val fqName: FqName) : MemberScopeImpl() {
override fun getPackage(name: Name): PackageViewDescriptor? {
protected fun getPackage(name: Name): PackageViewDescriptor? {
if (name.isSpecial()) {
return null
}
@@ -37,10 +37,6 @@ public abstract class AbstractScopeAdapter : MemberScope {
return workerScope.getContributedFunctions(name, location)
}
override fun getPackage(name: Name): PackageViewDescriptor? {
return workerScope.getPackage(name)
}
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
return workerScope.getContributedClassifier(name, location)
}
@@ -32,9 +32,6 @@ public class ChainedScope(
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
= getFirstMatch(scopeChain) { it.getContributedClassifier(name, location) }
override fun getPackage(name: Name): PackageViewDescriptor?
= getFirstMatch(scopeChain) { it.getPackage(name) }
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor>
= getFromAllScopes(scopeChain) { it.getContributedVariables(name, location) }
@@ -27,9 +27,6 @@ public interface MemberScope : ResolutionScope {
public override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor>
@Deprecated("Should be removed soon")
public fun getPackage(name: Name): PackageViewDescriptor?
/**
* Is supposed to be used in tests and debug only
*/
@@ -26,8 +26,6 @@ abstract class MemberScopeImpl : MemberScope {
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> = emptyList()
override fun getPackage(name: Name): PackageViewDescriptor? = null
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
@@ -65,8 +65,6 @@ public class SubstitutingScope(private val workerScope: MemberScope, private val
override fun getContributedFunctions(name: Name, location: LookupLocation) = substitute(workerScope.getContributedFunctions(name, location))
override fun getPackage(name: Name) = workerScope.getPackage(name)
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean) = _allDescriptors
@@ -180,11 +180,6 @@ public class ErrorUtils {
return ERROR_PROPERTY_GROUP;
}
@Override
public PackageViewDescriptor getPackage(@NotNull Name name) {
return null;
}
@NotNull
@Override
public Set<FunctionDescriptor> getContributedFunctions(@NotNull Name name, @NotNull LookupLocation location) {
@@ -223,12 +218,6 @@ public class ErrorUtils {
throw new IllegalStateException();
}
@Nullable
@Override
public PackageViewDescriptor getPackage(@NotNull Name name) {
throw new IllegalStateException();
}
@NotNull
@Override
@SuppressWarnings({"unchecked"}) // KT-9898 Impossible implement kotlin interface from java