don't create resolve tasks with lists of candidates which are known to be empty
This commit is contained in:
@@ -40,9 +40,11 @@ public class ResolutionTaskHolder<D : CallableDescriptor, F : D>(
|
|||||||
public fun addCandidates(candidatesList: List<Collection<ResolutionCandidate<D>>>) {
|
public fun addCandidates(candidatesList: List<Collection<ResolutionCandidate<D>>>) {
|
||||||
assertNotFinished()
|
assertNotFinished()
|
||||||
for (candidates in candidatesList) {
|
for (candidates in candidatesList) {
|
||||||
|
if (candidates.isNotEmpty()) {
|
||||||
addCandidates { candidates }
|
addCandidates { candidates }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun assertNotFinished() {
|
private fun assertNotFinished() {
|
||||||
assert(internalTasks == null, "Can't add candidates after the resulting tasks were computed.")
|
assert(internalTasks == null, "Can't add candidates after the resulting tasks were computed.")
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
|
|||||||
val taskPrioritizerContext = TaskPrioritizerContext(name, result, context, context.scope, callableDescriptorCollectors)
|
val taskPrioritizerContext = TaskPrioritizerContext(name, result, context, context.scope, callableDescriptorCollectors)
|
||||||
|
|
||||||
if (explicitReceiver is QualifierReceiver) {
|
if (explicitReceiver is QualifierReceiver) {
|
||||||
val qualifierReceiver = explicitReceiver : QualifierReceiver
|
val qualifierReceiver: QualifierReceiver = explicitReceiver
|
||||||
doComputeTasks(NO_RECEIVER, taskPrioritizerContext.replaceScope(qualifierReceiver.getNestedClassesAndPackageMembersScope()))
|
doComputeTasks(NO_RECEIVER, taskPrioritizerContext.replaceScope(qualifierReceiver.getNestedClassesAndPackageMembersScope()))
|
||||||
computeTasksForClassObjectReceiver(qualifierReceiver, taskPrioritizerContext)
|
computeTasksForClassObjectReceiver(qualifierReceiver, taskPrioritizerContext)
|
||||||
}
|
}
|
||||||
@@ -252,14 +252,15 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
|
|||||||
c.context.call
|
c.context.call
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (members.isNotEmpty()) {
|
||||||
val nonlocals = Lists.newArrayList<ResolutionCandidate<D>>()
|
val nonlocals = Lists.newArrayList<ResolutionCandidate<D>>()
|
||||||
val locals = Lists.newArrayList<ResolutionCandidate<D>>()
|
val locals = Lists.newArrayList<ResolutionCandidate<D>>()
|
||||||
//noinspection unchecked,RedundantTypeArguments
|
|
||||||
splitLexicallyLocalDescriptors(members, c.scope.getContainingDeclaration(), locals, nonlocals)
|
splitLexicallyLocalDescriptors(members, c.scope.getContainingDeclaration(), locals, nonlocals)
|
||||||
|
|
||||||
localsList.add(locals)
|
localsList.add(locals)
|
||||||
nonlocalsList.add(nonlocals)
|
nonlocalsList.add(nonlocals)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//locals
|
//locals
|
||||||
c.result.addCandidates(localsList)
|
c.result.addCandidates(localsList)
|
||||||
|
|||||||
Reference in New Issue
Block a user