Use union of all available descriptors in composite importing scope
This commit is contained in:
@@ -187,8 +187,9 @@ class CompositePrioritizedImportingScope(
|
|||||||
nameFilter: (Name) -> Boolean,
|
nameFilter: (Name) -> Boolean,
|
||||||
changeNamesForAliased: Boolean
|
changeNamesForAliased: Boolean
|
||||||
): Collection<DeclarationDescriptor> {
|
): Collection<DeclarationDescriptor> {
|
||||||
return primaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased)
|
return primaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased).union(
|
||||||
.ifEmpty { secondaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased) }
|
secondaryScope.getContributedDescriptors(kindFilter, nameFilter, changeNamesForAliased)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun computeImportedNames(): Set<Name>? {
|
override fun computeImportedNames(): Set<Name>? {
|
||||||
@@ -206,15 +207,14 @@ class CompositePrioritizedImportingScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<VariableDescriptor> {
|
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<VariableDescriptor> {
|
||||||
return primaryScope.getContributedVariables(name, location).ifEmpty {
|
return primaryScope.getContributedVariables(name, location).union(
|
||||||
secondaryScope.getContributedVariables(name, location)
|
secondaryScope.getContributedVariables(name, location)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
return primaryScope.getContributedFunctions(name, location).ifEmpty {
|
return primaryScope.getContributedFunctions(name, location).union(
|
||||||
secondaryScope.getContributedFunctions(name, location)
|
secondaryScope.getContributedFunctions(name, location)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user