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:
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
import java.util.Collection;
|
||||
|
||||
public class KotlinCodegenFacade {
|
||||
public static void compileCorrectFiles(@NotNull GenerationState state) {
|
||||
public static void compileCorrectFiles(@NotNull GenerationState state, CodegenFactory codegenFactory) {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||
|
||||
state.beforeCompile();
|
||||
@@ -33,11 +33,11 @@ public class KotlinCodegenFacade {
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||
|
||||
CodegenFactory.IrConversionInput psi2irInput = CodegenFactory.IrConversionInput.Companion.fromGenerationState(state);
|
||||
CodegenFactory.BackendInput backendInput = state.getCodegenFactory().convertToIr(psi2irInput);
|
||||
CodegenFactory.BackendInput backendInput = codegenFactory.convertToIr(psi2irInput);
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
|
||||
|
||||
state.getCodegenFactory().generateModule(state, backendInput);
|
||||
codegenFactory.generateModule(state, backendInput);
|
||||
|
||||
CodegenFactory.Companion.doCheckCancelled(state);
|
||||
state.getFactory().done();
|
||||
|
||||
@@ -62,7 +62,6 @@ class GenerationState private constructor(
|
||||
val files: List<KtFile>,
|
||||
val configuration: CompilerConfiguration,
|
||||
val generateDeclaredClassFilter: GenerateClassFilter,
|
||||
val codegenFactory: CodegenFactory,
|
||||
val targetId: TargetId?,
|
||||
moduleName: String?,
|
||||
val outDirectory: File?,
|
||||
@@ -86,10 +85,6 @@ class GenerationState private constructor(
|
||||
fun generateDeclaredClassFilter(v: GenerateClassFilter) =
|
||||
apply { generateDeclaredClassFilter = v }
|
||||
|
||||
private var codegenFactory: CodegenFactory = DefaultCodegenFactory
|
||||
fun codegenFactory(v: CodegenFactory) =
|
||||
apply { codegenFactory = v }
|
||||
|
||||
private var targetId: TargetId? = null
|
||||
fun targetId(v: TargetId?) =
|
||||
apply { targetId = v }
|
||||
@@ -135,7 +130,7 @@ class GenerationState private constructor(
|
||||
fun build() =
|
||||
GenerationState(
|
||||
project, builderFactory, module, bindingContext, files, configuration,
|
||||
generateDeclaredClassFilter, codegenFactory, targetId,
|
||||
generateDeclaredClassFilter, targetId,
|
||||
moduleName, outDirectory, onIndependentPartCompilationEnd, wantsDiagnostics,
|
||||
jvmBackendClassResolver, isIrBackend, ignoreErrors,
|
||||
diagnosticReporter ?: DiagnosticReporterFactory.createReporter(),
|
||||
|
||||
Reference in New Issue
Block a user