JVM_IR: reorganize initialization of JvmGeneratorExtensionsImpl

CachedFields are now created at initialization.
Therefore we need CompilerConfiguration as a constructor parameter.
This commit is contained in:
Georgy Bronnikov
2021-06-07 17:52:17 +03:00
committed by TeamCityServer
parent 7bbc04b6a2
commit 20b76d4149
12 changed files with 36 additions and 42 deletions
@@ -113,11 +113,15 @@ object GenerationUtils {
// TODO: add running checkers and check that it's safe to compile
val firAnalyzerFacade = FirAnalyzerFacade(session, configuration.languageVersionSettings, files)
val extensions = JvmGeneratorExtensionsImpl()
val extensions = JvmGeneratorExtensionsImpl(configuration)
val (moduleFragment, symbolTable, components) = firAnalyzerFacade.convertToIr(extensions)
val dummyBindingContext = NoScopeRecordCliBindingTrace().bindingContext
val codegenFactory = JvmIrCodegenFactory(configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases))
val codegenFactory = JvmIrCodegenFactory(
configuration,
configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases),
jvmGeneratorExtensions = extensions
)
// Create and initialize the test module and its dependencies
val container = TopDownAnalyzerFacadeForJVM.createContainer(
@@ -194,7 +198,10 @@ object GenerationUtils {
files, configuration
).codegenFactory(
if (isIrBackend)
JvmIrCodegenFactory(configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases))
JvmIrCodegenFactory(
configuration,
configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jvmPhases),
)
else DefaultCodegenFactory
).isIrBackend(isIrBackend).apply(configureGenerationState).build()
if (analysisResult.shouldGenerateCode) {