Move CompilerEnvironment from 'frontend' to 'cli'
This is needed in order to have a single convenient place where to register frontend services implemented _outside_ of the 'frontend' module, such as the control flow analysis, extracted to a separate module in a subsequent commit.
This commit is contained in:
committed by
Alexander Udalov
parent
3efbca85ea
commit
ca5a35b4b3
+4
-3
@@ -32,9 +32,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils.sortedDiagnostics
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.AnalyzingUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExperimentalUsageChecker
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices
|
||||
|
||||
@@ -42,6 +40,9 @@ class AnalyzerWithCompilerReport(
|
||||
private val messageCollector: MessageCollector,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
) : AbstractAnalyzerWithCompilerReport {
|
||||
override val targetEnvironment: TargetEnvironment
|
||||
get() = CompilerEnvironment
|
||||
|
||||
override lateinit var analysisResult: AnalysisResult
|
||||
|
||||
constructor(configuration: CompilerConfiguration) : this(
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
||||
import java.io.File
|
||||
|
||||
internal val KotlinCoreEnvironment.destDir: File?
|
||||
@@ -50,7 +51,7 @@ private fun runCommonAnalysis(
|
||||
analyzer.analyzeAndReport(files) {
|
||||
CommonResolverForModuleFactory.analyzeFiles(
|
||||
files, moduleName, dependOnBuiltins, configuration.languageVersionSettings,
|
||||
CommonPlatforms.defaultCommonPlatform,
|
||||
CommonPlatforms.defaultCommonPlatform, CompilerEnvironment,
|
||||
dependenciesContainer = dependencyContainer
|
||||
) { content ->
|
||||
environment.createPackagePartProvider(content.moduleContentScope)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve
|
||||
|
||||
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
|
||||
object CompilerEnvironment : TargetEnvironment("Compiler") {
|
||||
override fun configure(container: StorageComponentContainer) {
|
||||
configureCompilerEnvironment(container)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user