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:
Ilya Chernikov
2020-06-08 16:45:30 +02:00
parent a0efd1e323
commit 484d026d2f
6 changed files with 63 additions and 57 deletions
@@ -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) }