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:
+2
-5
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilder
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactory
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.compilerRunner.OutputItemsCollector
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
@@ -76,7 +73,7 @@ class JvmAbiAnalysisHandlerExtension(
|
||||
files.toList(),
|
||||
compilerConfiguration
|
||||
).targetId(targetId).build()
|
||||
KotlinCodegenFacade.compileCorrectFiles(generationState)
|
||||
KotlinCodegenFacade.compileCorrectFiles(generationState, DefaultCodegenFactory)
|
||||
|
||||
val outputDir = compilerConfiguration.get(JVMConfigurationKeys.OUTPUT_DIRECTORY)!!
|
||||
val outputs = ArrayList<AbiOutput>()
|
||||
|
||||
@@ -277,15 +277,15 @@ abstract class AbstractKapt3Extension(
|
||||
compilerConfiguration
|
||||
).targetId(targetId)
|
||||
.isIrBackend(isIrBackend)
|
||||
.codegenFactory(
|
||||
.build()
|
||||
|
||||
val (classFilesCompilationTime) = measureTimeMillis {
|
||||
KotlinCodegenFacade.compileCorrectFiles(
|
||||
generationState,
|
||||
if (isIrBackend)
|
||||
JvmIrCodegenFactory(compilerConfiguration, compilerConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG))
|
||||
else DefaultCodegenFactory
|
||||
)
|
||||
.build()
|
||||
|
||||
val (classFilesCompilationTime) = measureTimeMillis {
|
||||
KotlinCodegenFacade.compileCorrectFiles(generationState)
|
||||
}
|
||||
|
||||
val compiledClasses = builderFactory.compiledClasses
|
||||
|
||||
-1
@@ -197,7 +197,6 @@ open class KJvmReplCompilerBase<AnalyzerT : ReplCodeAnalyzerBase>(
|
||||
sourceFiles,
|
||||
compilationState.environment.configuration
|
||||
)
|
||||
.codegenFactory(codegenFactory)
|
||||
.build()
|
||||
|
||||
codegenFactory.generateModule(
|
||||
|
||||
+8
-7
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user