Backend: remove psi files from generation state

pass them explicitly to all destinations. 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 17:22:24 +03:00
committed by teamcity
parent da41fddabb
commit 2044754628
22 changed files with 64 additions and 62 deletions
@@ -165,11 +165,11 @@ open class KJvmReplCompilerBase<AnalyzerT : ReplCodeAnalyzerBase>(
ClassBuilderFactories.BINARIES,
compilationState.analyzerEngine.module,
compilationState.analyzerEngine.trace.bindingContext,
sourceFiles,
compilationState.environment.configuration
).build().also { generationState ->
generationState.scriptSpecific.earlierScriptsForReplInterpreter = state.history.map { it.item }
generationState.beforeCompile()
generationState.oldBEInitTrace(sourceFiles)
}
KotlinCodegenFacade.generatePackage(generationState, snippetKtFile.script!!.containingKtFile.packageFqName, sourceFiles)
@@ -194,14 +194,13 @@ open class KJvmReplCompilerBase<AnalyzerT : ReplCodeAnalyzerBase>(
ClassBuilderFactories.BINARIES,
compilationState.analyzerEngine.module,
compilationState.analyzerEngine.trace.bindingContext,
sourceFiles,
compilationState.environment.configuration
)
.build()
codegenFactory.generateModule(
generationState,
codegenFactory.convertToIr(CodegenFactory.IrConversionInput.fromGenerationState(generationState)),
codegenFactory.convertToIr(CodegenFactory.IrConversionInput.fromGenerationStateAndFiles(generationState, sourceFiles)),
)
return generationState
@@ -244,12 +244,12 @@ private fun generate(
ClassBuilderFactories.BINARIES,
analysisResult.moduleDescriptor,
analysisResult.bindingContext,
sourceFiles,
kotlinCompilerConfiguration
).diagnosticReporter(
diagnosticsReporter
).build().also {
KotlinCodegenFacade.compileCorrectFiles(
sourceFiles,
it,
if (kotlinCompilerConfiguration.getBoolean(JVMConfigurationKeys.IR))
JvmIrCodegenFactory(
@@ -96,12 +96,12 @@ open class GenericReplCompiler(
ClassBuilderFactories.BINARIES,
compilerState.analyzerEngine.module,
compilerState.analyzerEngine.trace.bindingContext,
listOf(psiFile),
compilerConfiguration
).build()
generationState.scriptSpecific.earlierScriptsForReplInterpreter = compilerState.history.map { it.item }
generationState.beforeCompile()
generationState.oldBEInitTrace(listOf(psiFile))
KotlinCodegenFacade.generatePackage(
generationState,
psiFile.script!!.containingKtFile.packageFqName,