Optimize resolution scope queries from the synthetic scopes
now required descriptors are queried in advance and passed to the methods, to avoid multiple same name queries in a row
This commit is contained in:
+5
-3
@@ -469,9 +469,11 @@ fun ResolutionScope.collectSyntheticStaticMembersAndConstructors(
|
||||
nameFilter: (Name) -> Boolean
|
||||
): List<FunctionDescriptor> {
|
||||
val syntheticScopes = resolutionFacade.getFrontendService(SyntheticScopes::class.java)
|
||||
return (syntheticScopes.forceEnableSamAdapters().collectSyntheticStaticFunctions(this) + syntheticScopes.collectSyntheticConstructors(
|
||||
this
|
||||
)).filter { kindFilter.accepts(it) && nameFilter(it.name) }
|
||||
val functionDescriptors = getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||
val classifierDescriptors = getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS)
|
||||
return (syntheticScopes.forceEnableSamAdapters().collectSyntheticStaticFunctions(functionDescriptors) +
|
||||
syntheticScopes.collectSyntheticConstructors(classifierDescriptors))
|
||||
.filter { kindFilter.accepts(it) && nameFilter(it.name) }
|
||||
}
|
||||
|
||||
// New Inference disables scope with synthetic SAM-adapters because it uses conversions for resolution
|
||||
|
||||
@@ -471,7 +471,9 @@ class KotlinIndicesHelper(
|
||||
|
||||
// SAM-adapter
|
||||
val syntheticScopes = resolutionFacade.getFrontendService(SyntheticScopes::class.java).forceEnableSamAdapters()
|
||||
syntheticScopes.collectSyntheticStaticFunctions(container.staticScope, descriptor.name, NoLookupLocation.FROM_IDE)
|
||||
val contributedFunctions = container.staticScope.getContributedFunctions(descriptor.name, NoLookupLocation.FROM_IDE)
|
||||
|
||||
syntheticScopes.collectSyntheticStaticFunctions(contributedFunctions, NoLookupLocation.FROM_IDE)
|
||||
.filterIsInstance<SamAdapterDescriptor<*>>()
|
||||
.firstOrNull { it.baseDescriptorForSynthetic.original == descriptor.original }
|
||||
?.let { processor(it) }
|
||||
|
||||
Reference in New Issue
Block a user