Replaced usages of JetScope.getAllDescriptors() with JetScope.getDescriptors() (where makes sense)

This commit is contained in:
Valentin Kipyatkov
2014-10-30 13:42:46 +03:00
parent 2dd41028fd
commit 1983a9f3da
22 changed files with 48 additions and 36 deletions
@@ -282,7 +282,7 @@ public abstract class LazyJavaMemberScope(
override fun getLocalVariable(name: Name): VariableDescriptor? = null
override fun getDeclarationsByLabel(labelName: Name) = listOf<DeclarationDescriptor>()
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
override fun getOwnDeclaredDescriptors() = getDescriptors()
override fun getDescriptors(kindFilter: (JetScope.DescriptorKind) -> Boolean,
nameFilter: (String) -> Boolean) = allDescriptors()
@@ -102,7 +102,7 @@ public class LazyPackageFragmentScopeForJavaPackage(
override fun getFunctions(name: Name) = deserializedPackageScope().getFunctions(name) + super.getFunctions(name)
override fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>) {
result.addAll(deserializedPackageScope().getAllDescriptors())
result.addAll(deserializedPackageScope().getDescriptors())
}
override fun computeMemberIndex(): MemberIndex = object : MemberIndex by EMPTY_MEMBER_INDEX {
@@ -77,7 +77,7 @@ public class ChainedScope(private val containingDeclaration: DeclarationDescript
if (_allDescriptors == null) {
_allDescriptors = HashSet<DeclarationDescriptor>()
for (scope in scopeChain) {
_allDescriptors!!.addAll(scope.getAllDescriptors())
_allDescriptors!!.addAll(scope.getDescriptors())
}
}
return _allDescriptors!!
@@ -17,11 +17,8 @@
package org.jetbrains.jet.lang.resolve.scopes
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
import org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor
import org.jetbrains.jet.lang.resolve.name.Name
import java.util.Collections
public class InnerClassesScopeWrapper(override val workerScope: JetScope) : AbstractScopeAdapter() {
@@ -30,7 +27,10 @@ public class InnerClassesScopeWrapper(override val workerScope: JetScope) : Abst
override fun getDeclarationsByLabel(labelName: Name) = workerScope.getDeclarationsByLabel(labelName).filterIsInstance(javaClass<ClassDescriptor>())
override fun getDescriptors(kindFilter: (JetScope.DescriptorKind) -> Boolean,
nameFilter: (String) -> Boolean) = workerScope.getDescriptors(kindFilter, nameFilter).filterIsInstance(javaClass<ClassDescriptor>())
nameFilter: (String) -> Boolean): List<ClassDescriptor> {
if (!kindFilter(JetScope.DescriptorKind.CLASSIFIER)) return listOf()
return workerScope.getDescriptors({ it == JetScope.DescriptorKind.CLASSIFIER }, nameFilter).filterIsInstance(javaClass<ClassDescriptor>())
}
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = listOf()
@@ -44,7 +44,7 @@ public trait JetScope {
*
* @return All visible descriptors from current scope.
*/
public fun getAllDescriptors(): Collection<DeclarationDescriptor> = getDescriptors(DescriptorKind.ALL, {true})
public fun getAllDescriptors(): Collection<DeclarationDescriptor> = getDescriptors()
/**
* All visible descriptors from current scope possibly filtered by the given name and kind filters
@@ -90,7 +90,12 @@ public trait JetScope {
public val ALL: (DescriptorKind) -> Boolean = { true }
public val EXTENSIONS: (DescriptorKind) -> Boolean = { it == EXTENSION_FUNCTION || it == EXTENSION_PROPERTY }
public val FUNCTIONS: (DescriptorKind) -> Boolean = { it == NON_EXTENSION_FUNCTION || it == EXTENSION_FUNCTION }
public val CALLABLES: (DescriptorKind) -> Boolean = { it != CLASSIFIER && it != PACKAGE }
public val NON_EXTENSION_CALLABLES: (DescriptorKind) -> Boolean = { it == NON_EXTENSION_FUNCTION || it == NON_EXTENSION_PROPERTY || it == LOCAL_VARIABLE }
public val NON_EXTENSIONS: (DescriptorKind) -> Boolean = { it != EXTENSION_FUNCTION && it != EXTENSION_PROPERTY }
public val CLASSIFIERS: (DescriptorKind) -> Boolean = { it == CLASSIFIER }
public val PACKAGES: (DescriptorKind) -> Boolean = { it == PACKAGE }
public val VARIABLES_AND_PROPERTIES: (DescriptorKind) -> Boolean = { it == LOCAL_VARIABLE || it == NON_EXTENSION_PROPERTY || it == EXTENSION_PROPERTY }
}
}
@@ -28,7 +28,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
private var substitutedDescriptors: MutableMap<DeclarationDescriptor, DeclarationDescriptor?>? = null
private val _allDescriptors by Delegates.lazy { substitute(workerScope.getAllDescriptors()) }
private val _allDescriptors by Delegates.lazy { substitute(workerScope.getDescriptors()) }
private fun <D : DeclarationDescriptor> substitute(descriptor: D?): D? {
if (descriptor == null) return null