[FIR] KT-57220 Avoid creating useless synthetic function providers
- This optimization applied to LL FIR can be extended to K2 as a whole. Likely, there won't be any performance benefits in CLI runs, but it's still better to avoid useless symbol providers.
This commit is contained in:
committed by
Space Team
parent
2d85e9db51
commit
d9f515fbb8
+15
@@ -46,6 +46,21 @@ class FirExtensionSyntheticFunctionInterfaceProvider(
|
||||
moduleData: FirModuleData,
|
||||
kotlinScopeProvider: FirKotlinScopeProvider
|
||||
) : FirSyntheticFunctionInterfaceProviderBase(session, moduleData, kotlinScopeProvider) {
|
||||
companion object {
|
||||
/**
|
||||
* A [FirExtensionSyntheticFunctionInterfaceProvider] only needs to be created if the session's function type service has extension
|
||||
* function kinds. Otherwise, the provider would be useless.
|
||||
*/
|
||||
fun createIfNeeded(
|
||||
session: FirSession,
|
||||
moduleData: FirModuleData,
|
||||
kotlinScopeProvider: FirKotlinScopeProvider,
|
||||
): FirExtensionSyntheticFunctionInterfaceProvider? {
|
||||
if (!session.functionTypeService.hasExtensionKinds()) return null
|
||||
return FirExtensionSyntheticFunctionInterfaceProvider(session, moduleData, kotlinScopeProvider)
|
||||
}
|
||||
}
|
||||
|
||||
override fun FunctionTypeKind.isAcceptable(): Boolean {
|
||||
return !this.isBuiltin
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user