Refactor GenerationState creation

This commit is contained in:
Dmitry Petrov
2017-11-28 16:49:19 +03:00
parent d6d6cef10d
commit d976eeabf7
10 changed files with 97 additions and 44 deletions
@@ -59,11 +59,12 @@ object GenerationUtils {
val analysisResult = JvmResolveUtil.analyzeAndCheckForErrors(files.first().project, files, configuration, packagePartProvider)
analysisResult.throwIfError()
val state = GenerationState(
val state = GenerationState.Builder(
files.first().project, classBuilderFactory, analysisResult.moduleDescriptor, analysisResult.bindingContext,
files, configuration,
codegenFactory = if (configuration.getBoolean(JVMConfigurationKeys.IR)) JvmIrCodegenFactory else DefaultCodegenFactory
)
files, configuration
).codegenFactory(
if (configuration.getBoolean(JVMConfigurationKeys.IR)) JvmIrCodegenFactory else DefaultCodegenFactory
).build()
if (analysisResult.shouldGenerateCode) {
KotlinCodegenFacade.compileCorrectFiles(state, CompilationErrorHandler.THROW_EXCEPTION)
}