Backend: remove codegen factory from generation state

use it explicitly. This is a step in attempt to abstract dependencies
on PSI in the GenerationState and related places.
This commit is contained in:
Ilya Chernikov
2022-02-15 12:54:20 +03:00
committed by teamcity
parent 018782f0c7
commit da41fddabb
15 changed files with 37 additions and 50 deletions
@@ -125,8 +125,6 @@ object GenerationUtils {
val generationState = GenerationState.Builder(
project, classBuilderFactory, moduleFragment.descriptor, dummyBindingContext, files, configuration
).codegenFactory(
codegenFactory
).isIrBackend(
true
).jvmBackendClassResolver(
@@ -191,13 +189,14 @@ object GenerationUtils {
val generationState = GenerationState.Builder(
project, classBuilderFactory, analysisResult.moduleDescriptor, analysisResult.bindingContext,
files, configuration
).codegenFactory(
if (isIrBackend)
JvmIrCodegenFactory(configuration, configuration.get(CLIConfigurationKeys.PHASE_CONFIG))
else DefaultCodegenFactory
).isIrBackend(isIrBackend).apply(configureGenerationState).build()
if (analysisResult.shouldGenerateCode) {
KotlinCodegenFacade.compileCorrectFiles(generationState)
KotlinCodegenFacade.compileCorrectFiles(
generationState,
if (isIrBackend)
JvmIrCodegenFactory(configuration, configuration.get(CLIConfigurationKeys.PHASE_CONFIG))
else DefaultCodegenFactory
)
}
return generationState
}