Removed getAllDescriptors() and getOwnDeclaredDescriptors() from KtScope

This commit is contained in:
Stanislav Erokhin
2015-11-02 16:12:10 +03:00
parent 0b5de434fa
commit f7629b0c84
19 changed files with 15 additions and 79 deletions
@@ -303,8 +303,6 @@ public abstract class LazyJavaScope(
return properties(name)
}
override fun getOwnDeclaredDescriptors() = getDescriptors()
override fun getDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean) = allDescriptors()
@@ -58,10 +58,6 @@ public abstract class AbstractScopeAdapter : KtScope {
return workerScope.getDescriptors(kindFilter, nameFilter)
}
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> {
return workerScope.getOwnDeclaredDescriptors()
}
override fun printScopeStructure(p: Printer) {
p.println(javaClass.getSimpleName(), " {")
p.pushIndent()
@@ -47,10 +47,6 @@ public open class ChainedScope(
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
= getFromAllScopes(scopeChain) { it.getDescriptors(kindFilter, nameFilter) }
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> {
throw UnsupportedOperationException()
}
override fun toString() = debugName
override fun printScopeStructure(p: Printer) {
@@ -36,14 +36,6 @@ public interface KtScope {
public fun getContainingDeclaration(): DeclarationDescriptor
/**
* All visible descriptors from current scope.
*
* @return All visible descriptors from current scope.
*/
@Deprecated("Removed in progress", ReplaceWith("getDescriptors()"))
public fun getAllDescriptors(): Collection<DeclarationDescriptor> = getDescriptors()
/**
* All visible descriptors from current scope possibly filtered by the given name and kind filters
* (that means that the implementation is not obliged to use the filters but may do so when it gives any performance advantage).
@@ -53,9 +45,6 @@ public interface KtScope {
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER
): Collection<DeclarationDescriptor>
// todo merge with getAllDescriptors()
public fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor>
/**
* Is supposed to be used in tests and debug only
*/
@@ -33,8 +33,6 @@ abstract class KtScopeImpl : KtScope {
override fun getDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = emptyList()
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> = emptyList()
// This method should not be implemented here by default: every scope class has its unique structure pattern
abstract override fun printScopeStructure(p: Printer)
}
@@ -51,8 +51,6 @@ public class StaticScopeForKotlinClass(
override fun getDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean) = functions + properties
override fun getOwnDeclaredDescriptors() = functions + properties
override fun getProperties(name: Name, location: LookupLocation) = properties.filterTo(ArrayList(1)) { it.name == name }
override fun getFunctions(name: Name, location: LookupLocation) = functions.filterTo(ArrayList<FunctionDescriptor>(2)) { it.getName() == name }
@@ -72,8 +72,6 @@ public class SubstitutingScope(private val workerScope: KtScope, private val sub
override fun getDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean) = _allDescriptors
override fun getOwnDeclaredDescriptors() = substitute(workerScope.getOwnDeclaredDescriptors())
override fun printScopeStructure(p: Printer) {
p.println(javaClass.getSimpleName(), " {")
p.pushIndent()
@@ -204,18 +204,6 @@ public class ErrorUtils {
return Collections.emptyList();
}
@NotNull
@Override
public Collection<DeclarationDescriptor> getAllDescriptors() {
return Collections.emptyList();
}
@NotNull
@Override
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
return Collections.emptyList();
}
@Override
public String toString() {
return "ErrorScope{" + debugMessage + '}';
@@ -272,18 +260,6 @@ public class ErrorUtils {
throw new IllegalStateException();
}
@NotNull
@Override
public Collection<DeclarationDescriptor> getAllDescriptors() {
throw new IllegalStateException();
}
@NotNull
@Override
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
throw new IllegalStateException();
}
@Override
public String toString() {
return "ThrowingScope{" + debugMessage + '}';
@@ -175,8 +175,6 @@ public abstract class DeserializedMemberScope protected constructor(
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
override fun getOwnDeclaredDescriptors() = getDescriptors()
override fun printScopeStructure(p: Printer) {
p.println(javaClass.simpleName, " {")
p.pushIndent()