Pass isIR flag from KotlinToJVMBytecodeCompiler to GenerationState

This commit is contained in:
Georgy Bronnikov
2019-10-17 11:17:51 +03:00
parent d1f25d1c26
commit 7f32f43a48
2 changed files with 10 additions and 3 deletions
@@ -64,7 +64,8 @@ class GenerationState private constructor(
val outDirectory: File?, val outDirectory: File?,
private val onIndependentPartCompilationEnd: GenerationStateEventCallback, private val onIndependentPartCompilationEnd: GenerationStateEventCallback,
wantsDiagnostics: Boolean, wantsDiagnostics: Boolean,
val jvmBackendClassResolver: JvmBackendClassResolver val jvmBackendClassResolver: JvmBackendClassResolver,
val isIrBackend: Boolean
) { ) {
class Builder( class Builder(
@@ -111,12 +112,16 @@ class GenerationState private constructor(
fun jvmBackendClassResolver(v: JvmBackendClassResolver) = fun jvmBackendClassResolver(v: JvmBackendClassResolver) =
apply { jvmBackendClassResolver = v } apply { jvmBackendClassResolver = v }
var isIrBackend: Boolean = configuration.getBoolean(JVMConfigurationKeys.IR)
fun isIrBackend(v: Boolean) =
apply { isIrBackend = v }
fun build() = fun build() =
GenerationState( GenerationState(
project, builderFactory, module, bindingContext, files, configuration, project, builderFactory, module, bindingContext, files, configuration,
generateDeclaredClassFilter, codegenFactory, targetId, generateDeclaredClassFilter, codegenFactory, targetId,
moduleName, outDirectory, onIndependentPartCompilationEnd, wantsDiagnostics, moduleName, outDirectory, onIndependentPartCompilationEnd, wantsDiagnostics,
jvmBackendClassResolver jvmBackendClassResolver, isIrBackend
) )
} }
@@ -196,7 +201,6 @@ class GenerationState private constructor(
) )
val bindingContext: BindingContext = bindingTrace.bindingContext val bindingContext: BindingContext = bindingTrace.bindingContext
val mainFunctionDetector = MainFunctionDetector(bindingContext, languageVersionSettings) val mainFunctionDetector = MainFunctionDetector(bindingContext, languageVersionSettings)
val isIrBackend = configuration.get(JVMConfigurationKeys.IR) ?: false
val typeMapper: KotlinTypeMapper = KotlinTypeMapper( val typeMapper: KotlinTypeMapper = KotlinTypeMapper(
this.bindingContext, this.bindingContext,
classBuilderMode, classBuilderMode,
@@ -353,6 +353,8 @@ object KotlinToJVMBytecodeCompiler {
module module
).onIndependentPartCompilationEnd( ).onIndependentPartCompilationEnd(
createOutputFilesFlushingCallbackIfPossible(moduleConfiguration) createOutputFilesFlushingCallbackIfPossible(moduleConfiguration)
).isIrBackend(
true
).build() ).build()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled() ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
@@ -623,6 +625,7 @@ object KotlinToJVMBytecodeCompiler {
) )
.withModule(module) .withModule(module)
.onIndependentPartCompilationEnd(createOutputFilesFlushingCallbackIfPossible(configuration)) .onIndependentPartCompilationEnd(createOutputFilesFlushingCallbackIfPossible(configuration))
.isIrBackend(isIR)
.build() .build()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled() ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()