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?,
private val onIndependentPartCompilationEnd: GenerationStateEventCallback,
wantsDiagnostics: Boolean,
val jvmBackendClassResolver: JvmBackendClassResolver
val jvmBackendClassResolver: JvmBackendClassResolver,
val isIrBackend: Boolean
) {
class Builder(
@@ -111,12 +112,16 @@ class GenerationState private constructor(
fun jvmBackendClassResolver(v: JvmBackendClassResolver) =
apply { jvmBackendClassResolver = v }
var isIrBackend: Boolean = configuration.getBoolean(JVMConfigurationKeys.IR)
fun isIrBackend(v: Boolean) =
apply { isIrBackend = v }
fun build() =
GenerationState(
project, builderFactory, module, bindingContext, files, configuration,
generateDeclaredClassFilter, codegenFactory, targetId,
moduleName, outDirectory, onIndependentPartCompilationEnd, wantsDiagnostics,
jvmBackendClassResolver
jvmBackendClassResolver, isIrBackend
)
}
@@ -196,7 +201,6 @@ class GenerationState private constructor(
)
val bindingContext: BindingContext = bindingTrace.bindingContext
val mainFunctionDetector = MainFunctionDetector(bindingContext, languageVersionSettings)
val isIrBackend = configuration.get(JVMConfigurationKeys.IR) ?: false
val typeMapper: KotlinTypeMapper = KotlinTypeMapper(
this.bindingContext,
classBuilderMode,
@@ -353,6 +353,8 @@ object KotlinToJVMBytecodeCompiler {
module
).onIndependentPartCompilationEnd(
createOutputFilesFlushingCallbackIfPossible(moduleConfiguration)
).isIrBackend(
true
).build()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
@@ -623,6 +625,7 @@ object KotlinToJVMBytecodeCompiler {
)
.withModule(module)
.onIndependentPartCompilationEnd(createOutputFilesFlushingCallbackIfPossible(configuration))
.isIrBackend(isIR)
.build()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()