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
@@ -197,7 +197,6 @@ open class KJvmReplCompilerBase<AnalyzerT : ReplCodeAnalyzerBase>(
sourceFiles,
compilationState.environment.configuration
)
.codegenFactory(codegenFactory)
.build()
codegenFactory.generateModule(
@@ -246,16 +246,17 @@ private fun generate(
analysisResult.bindingContext,
sourceFiles,
kotlinCompilerConfiguration
).codegenFactory(
if (kotlinCompilerConfiguration.getBoolean(JVMConfigurationKeys.IR))
JvmIrCodegenFactory(
kotlinCompilerConfiguration,
kotlinCompilerConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG),
) else DefaultCodegenFactory
).diagnosticReporter(
diagnosticsReporter
).build().also {
KotlinCodegenFacade.compileCorrectFiles(it)
KotlinCodegenFacade.compileCorrectFiles(
it,
if (kotlinCompilerConfiguration.getBoolean(JVMConfigurationKeys.IR))
JvmIrCodegenFactory(
kotlinCompilerConfiguration,
kotlinCompilerConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG),
) else DefaultCodegenFactory
)
FirDiagnosticsCompilerResultsReporter.reportToMessageCollector(
diagnosticsReporter,
messageCollector,