Drop location parameter from ResolutionScope::definitelyDoesNotContainName
definitelyDoesNotContainName is called too eagerly sometimes and it leads to obviously redundant lookups The idea is to put responsibility for calling recordLookup to resolution itself
This commit is contained in:
@@ -89,7 +89,7 @@ internal class MemberScopeTowerLevel(
|
||||
|
||||
fun definitelyDoesNotContainName(name: Name) =
|
||||
(dispatchReceiver.possibleTypes + dispatchReceiver.receiverValue.type)
|
||||
.all { !it.isDynamic() && it.memberScope.definitelyDoesNotContainName(name, location) }
|
||||
.all { !it.isDynamic() && it.memberScope.definitelyDoesNotContainName(name) }
|
||||
|
||||
private fun collectMembers(
|
||||
getMembers: ResolutionScope.(KotlinType?) -> Collection<CallableDescriptor>
|
||||
|
||||
@@ -199,8 +199,8 @@ class TowerResolver {
|
||||
private fun MemberScopeTowerLevel.mayFitForName(name: Name) =
|
||||
!definitelyDoesNotContainName(name) || !definitelyDoesNotContainName(OperatorNameConventions.INVOKE)
|
||||
|
||||
private fun ResolutionScope.mayFitForName(name: Name, location: LookupLocation) =
|
||||
!definitelyDoesNotContainName(name, location) || !definitelyDoesNotContainName(OperatorNameConventions.INVOKE, location)
|
||||
private fun ResolutionScope.mayFitForName(name: Name) =
|
||||
!definitelyDoesNotContainName(name) || !definitelyDoesNotContainName(OperatorNameConventions.INVOKE)
|
||||
|
||||
fun <C : Candidate> runWithEmptyTowerData(
|
||||
processor: ScopeTowerProcessor<C>,
|
||||
|
||||
@@ -125,6 +125,6 @@ abstract class LexicalScopeStorage(
|
||||
return result
|
||||
}
|
||||
|
||||
override fun definitelyDoesNotContainName(name: Name, location: LookupLocation) =
|
||||
override fun definitelyDoesNotContainName(name: Name) =
|
||||
functionsByName?.get(name) == null && variablesAndClassifiersByName?.get(name) == null
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ interface LexicalScope : HierarchicalScope {
|
||||
override val kind: LexicalScopeKind
|
||||
get() = LexicalScopeKind.EMPTY
|
||||
|
||||
override fun definitelyDoesNotContainName(name: Name, location: LookupLocation) = true
|
||||
override fun definitelyDoesNotContainName(name: Name) = true
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println("Base lexical scope with owner = $ownerDescriptor and parent = $parent")
|
||||
@@ -130,7 +130,7 @@ interface ImportingScope : HierarchicalScope {
|
||||
|
||||
override fun computeImportedNames() = emptySet<Name>()
|
||||
|
||||
override fun definitelyDoesNotContainName(name: Name, location: LookupLocation) = true
|
||||
override fun definitelyDoesNotContainName(name: Name) = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user