Got rid of two getContributedDescriptors calling each other

This commit is contained in:
Valentin Kipyatkov
2015-10-25 12:44:13 +03:00
parent ed6f845377
commit a6165f4690
5 changed files with 10 additions and 18 deletions
@@ -38,7 +38,8 @@ public class LexicalChainedScope(
override val parent = parent.takeSnapshot()
private val scopeChain = memberScopes.clone()
override fun getContributedDescriptors() = getFromAllScopes(scopeChain) { it.getAllDescriptors() }
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
= getFromAllScopes(scopeChain) { it.getAllDescriptors() }
override fun getContributedClassifier(name: Name, location: LookupLocation) = getFirstMatch(scopeChain) { it.getClassifier(name, location) }
@@ -44,7 +44,7 @@ public class LexicalScopeImpl @JvmOverloads constructor(
InitializeHandler(redeclarationHandler).initialize()
}
override fun getContributedDescriptors() = addedDescriptors
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean) = addedDescriptors
override fun getContributedClassifier(name: Name, location: LookupLocation) = getDeclaredClassifier(name)
@@ -70,7 +70,8 @@ class LexicalWritableScope(
addVariableOrClassDescriptor(classifierDescriptor)
}
override fun getContributedDescriptors() = checkMayRead().addedDescriptors
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
= checkMayRead().addedDescriptors
override fun getContributedClassifier(name: Name, location: LookupLocation) = checkMayRead().getDeclaredClassifier(name)
@@ -101,7 +102,8 @@ class LexicalWritableScope(
override val implicitReceiver: ReceiverParameterDescriptor?
get() = this@LexicalWritableScope.implicitReceiver
override fun getContributedDescriptors() = this@LexicalWritableScope.addedDescriptors.subList(0, descriptorLimit)
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
= this@LexicalWritableScope.addedDescriptors.subList(0, descriptorLimit)
override fun getContributedClassifier(name: Name, location: LookupLocation)
= this@LexicalWritableScope.getDeclaredClassifier(name, descriptorLimit)
@@ -226,8 +226,6 @@ private class MemberScopeToImportingScopeAdapter(override val parent: ImportingS
override val ownerDescriptor: DeclarationDescriptor
get() = memberScope.getContainingDeclaration()
override fun getContributedDescriptors() = memberScope.getOwnDeclaredDescriptors()
override fun getContributedClassifier(name: Name, location: LookupLocation) = memberScope.getClassifier(name, location)
override fun getContributedVariables(name: Name, location: LookupLocation) = memberScope.getProperties(name, location)