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:
+1
-2
@@ -70,10 +70,9 @@ class JvmAbiAnalysisHandlerExtension(
|
||||
AbiBinaries,
|
||||
module,
|
||||
bindingContext,
|
||||
files.toList(),
|
||||
compilerConfiguration
|
||||
).targetId(targetId).build()
|
||||
KotlinCodegenFacade.compileCorrectFiles(generationState, DefaultCodegenFactory)
|
||||
KotlinCodegenFacade.compileCorrectFiles(files, generationState, DefaultCodegenFactory)
|
||||
|
||||
val outputDir = compilerConfiguration.get(JVMConfigurationKeys.OUTPUT_DIRECTORY)!!
|
||||
val outputs = ArrayList<AbiOutput>()
|
||||
|
||||
@@ -273,7 +273,6 @@ abstract class AbstractKapt3Extension(
|
||||
builderFactory,
|
||||
module,
|
||||
bindingContext,
|
||||
files,
|
||||
compilerConfiguration
|
||||
).targetId(targetId)
|
||||
.isIrBackend(isIrBackend)
|
||||
@@ -281,6 +280,7 @@ abstract class AbstractKapt3Extension(
|
||||
|
||||
val (classFilesCompilationTime) = measureTimeMillis {
|
||||
KotlinCodegenFacade.compileCorrectFiles(
|
||||
files,
|
||||
generationState,
|
||||
if (isIrBackend)
|
||||
JvmIrCodegenFactory(compilerConfiguration, compilerConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG))
|
||||
|
||||
+2
-3
@@ -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
|
||||
|
||||
+1
-1
@@ -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(
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user