Rename PlatformDependentCompilerServices -> PlatformDependentAnalyzerServices
This commit is contained in:
+7
-7
@@ -22,8 +22,8 @@ import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.*
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
||||
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.context.ProjectContext
|
||||
@@ -69,8 +69,8 @@ object CommonResolverForModuleFactory : ResolverForModuleFactory() {
|
||||
override val platform: TargetPlatform
|
||||
get() = CommonPlatforms.defaultCommonPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = CommonPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = CommonPlatformAnalyzerServices
|
||||
}
|
||||
|
||||
fun analyzeFiles(
|
||||
@@ -138,7 +138,7 @@ object CommonResolverForModuleFactory : ResolverForModuleFactory() {
|
||||
val trace = CodeAnalyzerInitializer.getInstance(project).createTrace()
|
||||
val container = createContainerToResolveCommonCode(
|
||||
moduleContext, trace, declarationProviderFactory, moduleContentScope, targetEnvironment, metadataPartProvider,
|
||||
languageVersionSettings, CommonPlatforms.defaultCommonPlatform, CommonPlatformCompilerServices
|
||||
languageVersionSettings, CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices
|
||||
)
|
||||
|
||||
val packageFragmentProviders = listOf(
|
||||
@@ -159,10 +159,10 @@ private fun createContainerToResolveCommonCode(
|
||||
metadataPartProvider: MetadataPartProvider,
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
platform: TargetPlatform,
|
||||
compilerServices: PlatformDependentCompilerServices
|
||||
analyzerServices: PlatformDependentAnalyzerServices
|
||||
): StorageComponentContainer =
|
||||
createContainer("ResolveCommonCode", compilerServices) {
|
||||
configureModule(moduleContext, platform, compilerServices, bindingTrace, languageVersionSettings)
|
||||
createContainer("ResolveCommonCode", analyzerServices) {
|
||||
configureModule(moduleContext, platform, analyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
useInstance(moduleContentScope)
|
||||
useInstance(declarationProviderFactory)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ class FirDefaultSimpleImportingScope(session: FirSession) : FirAbstractSimpleImp
|
||||
|
||||
override val simpleImports = run {
|
||||
val importResolveTransformer = FirImportResolveTransformer(session)
|
||||
session.moduleInfo?.compilerServices?.getDefaultImports(LanguageVersionSettingsImpl.DEFAULT, true)
|
||||
session.moduleInfo?.analyzerServices?.getDefaultImports(LanguageVersionSettingsImpl.DEFAULT, true)
|
||||
?.filter { !it.isAllUnder }
|
||||
?.map {
|
||||
FirImportImpl(session, null, it.fqName, isAllUnder = false, aliasName = null)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ class FirDefaultStarImportingScope(session: FirSession, lookupInFir: Boolean = f
|
||||
FirAbstractStarImportingScope(session, lookupInFir) {
|
||||
|
||||
// TODO: put languageVersionSettings into FirSession?
|
||||
override val starImports = session.moduleInfo?.compilerServices?.getDefaultImports(LanguageVersionSettingsImpl.DEFAULT, true)
|
||||
override val starImports = session.moduleInfo?.analyzerServices?.getDefaultImports(LanguageVersionSettingsImpl.DEFAULT, true)
|
||||
?.filter { it.isAllUnder }
|
||||
?.map {
|
||||
FirResolvedImportImpl(
|
||||
|
||||
+6
-6
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@@ -150,8 +150,8 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
override fun dependencies(): List<ModuleInfo> {
|
||||
return listOf(this)
|
||||
@@ -162,8 +162,8 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
val dependencies = mutableListOf<ModuleInfo>(this)
|
||||
override fun dependencies(): List<ModuleInfo> {
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.analyzer
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ interface ModuleInfo {
|
||||
fun dependencies(): List<ModuleInfo>
|
||||
val expectedBy: List<ModuleInfo> get() = emptyList()
|
||||
val platform: TargetPlatform
|
||||
val compilerServices: PlatformDependentCompilerServices
|
||||
val analyzerServices: PlatformDependentAnalyzerServices
|
||||
fun modulesWhoseInternalsAreVisible(): Collection<ModuleInfo> = listOf()
|
||||
val capabilities: Map<ModuleDescriptor.Capability<*>, Any?>
|
||||
get() = mapOf(Capability to this)
|
||||
@@ -30,7 +30,7 @@ interface ModuleInfo {
|
||||
// but if they are present, they should come after JVM built-ins in the dependencies list, because JVM built-ins contain
|
||||
// additional members dependent on the JDK
|
||||
fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns =
|
||||
compilerServices?.dependencyOnBuiltIns() ?: ModuleInfo.DependencyOnBuiltIns.LAST
|
||||
analyzerServices?.dependencyOnBuiltIns() ?: ModuleInfo.DependencyOnBuiltIns.LAST
|
||||
|
||||
//TODO: (module refactoring) provide dependency on builtins after runtime in IDEA
|
||||
enum class DependencyOnBuiltIns { NONE, AFTER_SDK, LAST }
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import java.util.ArrayList
|
||||
|
||||
abstract class PlatformDependentCompilerServices {
|
||||
abstract class PlatformDependentAnalyzerServices {
|
||||
private data class DefaultImportsKey(val includeKotlinComparisons: Boolean, val includeLowPriorityImports: Boolean)
|
||||
|
||||
private val defaultImports = LockBasedStorageManager("TargetPlatform").let { storageManager ->
|
||||
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
import org.jetbrains.kotlin.types.SubstitutingScopeProviderImpl
|
||||
@@ -63,8 +63,8 @@ fun createContainerForLazyResolveWithJava(
|
||||
useBuiltInsProvider: Boolean,
|
||||
configureJavaClassFinder: (StorageComponentContainer.() -> Unit)? = null,
|
||||
javaClassTracker: JavaClassesTracker? = null
|
||||
): StorageComponentContainer = createContainer("LazyResolveWithJava", JvmPlatformCompilerServices) {
|
||||
configureModule(moduleContext, jvmPlatform, JvmPlatformCompilerServices, bindingTrace, languageVersionSettings)
|
||||
): StorageComponentContainer = createContainer("LazyResolveWithJava", JvmPlatformAnalyzerServices) {
|
||||
configureModule(moduleContext, jvmPlatform, JvmPlatformAnalyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
configureIncrementalCompilation(lookupTracker, expectActualTracker)
|
||||
configureStandardResolveComponents()
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
object JvmPlatformCompilerServices : PlatformDependentCompilerServices() {
|
||||
object JvmPlatformAnalyzerServices : PlatformDependentAnalyzerServices() {
|
||||
override fun computePlatformSpecificDefaultImports(storageManager: StorageManager, result: MutableList<ImportPath>) {
|
||||
result.add(ImportPath.fromString("kotlin.jvm.*"))
|
||||
|
||||
@@ -14,7 +14,7 @@ private object CommonPlatformConfigurator : PlatformConfiguratorBase() {
|
||||
override fun configureModuleComponents(container: StorageComponentContainer) {}
|
||||
}
|
||||
|
||||
object CommonPlatformCompilerServices : PlatformDependentCompilerServices() {
|
||||
object CommonPlatformAnalyzerServices : PlatformDependentAnalyzerServices() {
|
||||
override fun computePlatformSpecificDefaultImports(storageManager: StorageManager, result: MutableList<ImportPath>) {}
|
||||
|
||||
override val platformConfigurator: PlatformConfigurator = CommonPlatformConfigurator
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.types.expressions.LocalLazyDeclarationResolver
|
||||
fun StorageComponentContainer.configureModule(
|
||||
moduleContext: ModuleContext,
|
||||
platform: TargetPlatform,
|
||||
compilerServices: PlatformDependentCompilerServices,
|
||||
analyzerServices: PlatformDependentAnalyzerServices,
|
||||
trace: BindingTrace,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
@@ -55,11 +55,11 @@ fun StorageComponentContainer.configureModule(
|
||||
useInstance(languageVersionSettings)
|
||||
|
||||
useInstance(platform)
|
||||
useInstance(compilerServices)
|
||||
useInstance(analyzerServices)
|
||||
useInstance(platform.componentPlatforms.singleOrNull()?.targetPlatformVersion ?: TargetPlatformVersion.NoVersion)
|
||||
|
||||
compilerServices.platformConfigurator.configureModuleComponents(this)
|
||||
compilerServices.platformConfigurator.configureModuleDependentCheckers(this)
|
||||
analyzerServices.platformConfigurator.configureModuleComponents(this)
|
||||
analyzerServices.platformConfigurator.configureModuleDependentCheckers(this)
|
||||
|
||||
for (extension in StorageComponentContainerContributor.getInstances(moduleContext.project)) {
|
||||
extension.registerModuleComponents(this, platform, moduleContext.module)
|
||||
@@ -107,10 +107,10 @@ fun createContainerForBodyResolve(
|
||||
bindingTrace: BindingTrace,
|
||||
platform: TargetPlatform,
|
||||
statementFilter: StatementFilter,
|
||||
compilerServices: PlatformDependentCompilerServices,
|
||||
analyzerServices: PlatformDependentAnalyzerServices,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): StorageComponentContainer = createContainer("BodyResolve", compilerServices) {
|
||||
configureModule(moduleContext, platform, compilerServices, bindingTrace, languageVersionSettings)
|
||||
): StorageComponentContainer = createContainer("BodyResolve", analyzerServices) {
|
||||
configureModule(moduleContext, platform, analyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
useInstance(statementFilter)
|
||||
|
||||
@@ -127,10 +127,10 @@ fun createContainerForLazyBodyResolve(
|
||||
bindingTrace: BindingTrace,
|
||||
platform: TargetPlatform,
|
||||
bodyResolveCache: BodyResolveCache,
|
||||
compilerServices: PlatformDependentCompilerServices,
|
||||
analyzerServices: PlatformDependentAnalyzerServices,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): StorageComponentContainer = createContainer("LazyBodyResolve", compilerServices) {
|
||||
configureModule(moduleContext, platform, compilerServices, bindingTrace, languageVersionSettings)
|
||||
): StorageComponentContainer = createContainer("LazyBodyResolve", analyzerServices) {
|
||||
configureModule(moduleContext, platform, analyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
useInstance(kotlinCodeAnalyzer)
|
||||
useInstance(kotlinCodeAnalyzer.fileScopeProvider)
|
||||
@@ -149,9 +149,9 @@ fun createContainerForLazyLocalClassifierAnalyzer(
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
statementFilter: StatementFilter,
|
||||
localClassDescriptorHolder: LocalClassDescriptorHolder,
|
||||
compilerServices: PlatformDependentCompilerServices
|
||||
): StorageComponentContainer = createContainer("LocalClassifierAnalyzer", compilerServices) {
|
||||
configureModule(moduleContext, platform, compilerServices, bindingTrace, languageVersionSettings)
|
||||
analyzerServices: PlatformDependentAnalyzerServices
|
||||
): StorageComponentContainer = createContainer("LocalClassifierAnalyzer", analyzerServices) {
|
||||
configureModule(moduleContext, platform, analyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
useInstance(localClassDescriptorHolder)
|
||||
useInstance(lookupTracker)
|
||||
@@ -178,11 +178,11 @@ fun createContainerForLazyResolve(
|
||||
declarationProviderFactory: DeclarationProviderFactory,
|
||||
bindingTrace: BindingTrace,
|
||||
platform: TargetPlatform,
|
||||
compilerServices: PlatformDependentCompilerServices,
|
||||
analyzerServices: PlatformDependentAnalyzerServices,
|
||||
targetEnvironment: TargetEnvironment,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): StorageComponentContainer = createContainer("LazyResolve", compilerServices) {
|
||||
configureModule(moduleContext, platform, compilerServices, bindingTrace, languageVersionSettings)
|
||||
): StorageComponentContainer = createContainer("LazyResolve", analyzerServices) {
|
||||
configureModule(moduleContext, platform, analyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
configureStandardResolveComponents()
|
||||
|
||||
|
||||
@@ -119,5 +119,5 @@ abstract class PlatformConfiguratorBase(
|
||||
}
|
||||
}
|
||||
|
||||
fun createContainer(id: String, compilerServices: PlatformDependentCompilerServices, init: StorageComponentContainer.() -> Unit) =
|
||||
composeContainer(id, compilerServices.platformConfigurator.platformSpecificContainer, init)
|
||||
fun createContainer(id: String, analyzerServices: PlatformDependentAnalyzerServices, init: StorageComponentContainer.() -> Unit) =
|
||||
composeContainer(id, analyzerServices.platformConfigurator.platformSpecificContainer, init)
|
||||
|
||||
@@ -40,13 +40,13 @@ data class FileScopes(val lexicalScope: LexicalScope, val importingScope: Import
|
||||
class FileScopeFactory(
|
||||
private val topLevelDescriptorProvider: TopLevelDescriptorProvider,
|
||||
private val bindingTrace: BindingTrace,
|
||||
private val compilerServices: PlatformDependentCompilerServices,
|
||||
private val analyzerServices: PlatformDependentAnalyzerServices,
|
||||
private val components: ImportResolutionComponents
|
||||
) {
|
||||
private val defaultImports =
|
||||
compilerServices.getDefaultImports(components.languageVersionSettings, includeLowPriorityImports = false).map(::DefaultImportImpl)
|
||||
analyzerServices.getDefaultImports(components.languageVersionSettings, includeLowPriorityImports = false).map(::DefaultImportImpl)
|
||||
|
||||
private val defaultLowPriorityImports = compilerServices.defaultLowPriorityImports.map(::DefaultImportImpl)
|
||||
private val defaultLowPriorityImports = analyzerServices.defaultLowPriorityImports.map(::DefaultImportImpl)
|
||||
|
||||
private class DefaultImportImpl(private val importPath: ImportPath) : KtImportInfo {
|
||||
override val isAllUnder: Boolean get() = importPath.isAllUnder
|
||||
@@ -95,7 +95,7 @@ class FileScopeFactory(
|
||||
tempTrace,
|
||||
packageFragment = null,
|
||||
aliasImportNames = aliasImportNames,
|
||||
excludedImports = compilerServices.excludedImports
|
||||
excludedImports = analyzerServices.excludedImports
|
||||
)
|
||||
val lowPriority = createDefaultImportResolver(
|
||||
AllUnderImportsIndexed(defaultLowPriorityImports.also { imports ->
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ class LocalClassifierAnalyzer(
|
||||
private val typeResolver: TypeResolver,
|
||||
private val annotationResolver: AnnotationResolver,
|
||||
private val platform: TargetPlatform,
|
||||
private val compilerServices: PlatformDependentCompilerServices,
|
||||
private val analyzerServices: PlatformDependentAnalyzerServices,
|
||||
private val lookupTracker: LookupTracker,
|
||||
private val supertypeLoopChecker: SupertypeLoopChecker,
|
||||
private val languageVersionSettings: LanguageVersionSettings,
|
||||
@@ -103,7 +103,7 @@ class LocalClassifierAnalyzer(
|
||||
wrappedTypeFactory,
|
||||
substitutingScopeProvider
|
||||
),
|
||||
compilerServices
|
||||
analyzerServices
|
||||
)
|
||||
|
||||
container.get<LazyTopDownAnalyzer>().analyzeDeclarations(
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.js.analyze.TopDownAnalyzerFacadeForJS
|
||||
import org.jetbrains.kotlin.js.analyzer.JsAnalysisResult
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.js.resolve.MODULE_KIND
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -84,7 +84,7 @@ abstract class AbstractDiagnosticsTestWithJsStdLib : AbstractDiagnosticsTest() {
|
||||
override fun shouldSkipJvmSignatureDiagnostics(groupedByModule: Map<TestModule?, List<TestFile>>): Boolean = true
|
||||
|
||||
override fun createModule(moduleName: String, storageManager: StorageManager): ModuleDescriptorImpl =
|
||||
ModuleDescriptorImpl(Name.special("<$moduleName>"), storageManager, JsPlatformCompilerServices.builtIns)
|
||||
ModuleDescriptorImpl(Name.special("<$moduleName>"), storageManager, JsPlatformAnalyzerServices.builtIns)
|
||||
|
||||
override fun createSealedModule(storageManager: StorageManager): ModuleDescriptorImpl {
|
||||
val module = createModule("kotlin-js-test-module", storageManager)
|
||||
|
||||
@@ -8,15 +8,15 @@ package org.jetbrains.kotlin.fir
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
|
||||
class FirTestModuleInfo(
|
||||
override val name: Name = Name.identifier("TestModule"),
|
||||
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
|
||||
override val platform: TargetPlatform = JvmPlatforms.defaultJvmPlatform,
|
||||
override val compilerServices: PlatformDependentCompilerServices = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
|
||||
) : ModuleInfo {
|
||||
override fun dependencies(): List<ModuleInfo> = dependencies
|
||||
}
|
||||
+4
-4
@@ -27,12 +27,12 @@ import org.jetbrains.kotlin.context.ProjectContext
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmResolverForModuleFactory
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
|
||||
fun createResolveSessionForFiles(
|
||||
project: Project,
|
||||
@@ -69,6 +69,6 @@ private class TestModule(val dependsOnBuiltIns: Boolean) : ModuleInfo {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
}
|
||||
|
||||
@@ -27,17 +27,17 @@ import org.jetbrains.kotlin.frontend.di.configureModule
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.types.SubstitutingScopeProviderImpl
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||
import org.jetbrains.kotlin.types.expressions.FakeCallResolver
|
||||
|
||||
fun createContainerForTests(project: Project, module: ModuleDescriptor): ContainerForTests {
|
||||
return ContainerForTests(createContainer("Tests", JvmPlatformCompilerServices) {
|
||||
return ContainerForTests(createContainer("Tests", JvmPlatformAnalyzerServices) {
|
||||
configureModule(
|
||||
ModuleContext(module, project, "container for tests"),
|
||||
JvmPlatforms.defaultJvmPlatform,
|
||||
JvmPlatformCompilerServices,
|
||||
JvmPlatformAnalyzerServices,
|
||||
BindingTraceContext(),
|
||||
LanguageVersionSettingsImpl.DEFAULT
|
||||
)
|
||||
|
||||
+4
-4
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmResolverForModuleFactory
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
@@ -64,8 +64,8 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
}
|
||||
|
||||
fun testJavaEntitiesBelongToCorrectModule() {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.facade.K2JSTranslator
|
||||
import org.jetbrains.kotlin.js.facade.MainCallParameters
|
||||
import org.jetbrains.kotlin.js.facade.TranslationResult
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.serialization.AbstractVersionRequirementTest
|
||||
@@ -78,7 +78,7 @@ class JsVersionRequirementTest : AbstractVersionRequirementTest() {
|
||||
val config = JsConfig(environment.project, environment.configuration)
|
||||
return ContextForNewModule(
|
||||
ProjectContext(environment.project, "ProjectContext"),
|
||||
Name.special("<test>"), JsPlatformCompilerServices.builtIns, null
|
||||
Name.special("<test>"), JsPlatformAnalyzerServices.builtIns, null
|
||||
).apply {
|
||||
setDependencies(listOf(module) + config.moduleDescriptors + module.builtIns.builtInsModule)
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.js.analyze.TopDownAnalyzerFacadeForJS
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil.TEST_PACKAGE_FQNAME
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
|
||||
import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil.readModuleAsProto
|
||||
@@ -94,7 +94,7 @@ class KotlinJavascriptSerializerTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
private fun deserialize(metaFile: File): ModuleDescriptorImpl {
|
||||
val module = KotlinTestUtils.createEmptyModule("<${KotlinTestUtils.TEST_MODULE_NAME}>", JsPlatformCompilerServices.builtIns)
|
||||
val module = KotlinTestUtils.createEmptyModule("<${KotlinTestUtils.TEST_MODULE_NAME}>", JsPlatformAnalyzerServices.builtIns)
|
||||
val metadata = KotlinJavascriptMetadataUtils.loadMetadata(metaFile).single()
|
||||
|
||||
val (header, packageFragmentProtos) = readModuleAsProto(metadata.body, metadata.version)
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.types;
|
||||
import kotlin.Unit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonPlatformCompilerServices;
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl;
|
||||
import org.jetbrains.kotlin.container.DslKt;
|
||||
@@ -117,7 +117,7 @@ public class DefaultModalityModifiersTest extends KotlinTestWithEnvironment {
|
||||
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(), files),
|
||||
new BindingTraceContext(),
|
||||
CommonPlatforms.INSTANCE.getDefaultCommonPlatform(),
|
||||
CommonPlatformCompilerServices.INSTANCE,
|
||||
CommonPlatformAnalyzerServices.INSTANCE,
|
||||
CompilerEnvironment.INSTANCE,
|
||||
LanguageVersionSettingsImpl.DEFAULT
|
||||
);
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.context.ProjectContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.PlatformAnalysisSettings
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.js.resolve.JsResolverForModuleFactory
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind
|
||||
|
||||
class JsPlatformKindResolution : IdePlatformKindResolution {
|
||||
@@ -30,6 +30,6 @@ class JsPlatformKindResolution : IdePlatformKindResolution {
|
||||
get() = JsResolverForModuleFactory
|
||||
|
||||
override fun createBuiltIns(settings: PlatformAnalysisSettings, projectContext: ProjectContext): KotlinBuiltIns {
|
||||
return JsPlatformCompilerServices.builtIns
|
||||
return JsPlatformAnalyzerServices.builtIns
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -64,7 +64,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProviderImpl
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
@@ -305,11 +305,11 @@ internal object IDELightClassContexts {
|
||||
moduleDescriptor.setDependencies(moduleDescriptor, moduleDescriptor.builtIns.builtInsModule)
|
||||
|
||||
val moduleInfo = files.first().getModuleInfo()
|
||||
val container = createContainer("LightClassStub", JvmPlatformCompilerServices) {
|
||||
val container = createContainer("LightClassStub", JvmPlatformAnalyzerServices) {
|
||||
val jvmTarget = IDELanguageSettingsProvider.getTargetPlatform(moduleInfo, project) as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
configureModule(
|
||||
ModuleContext(moduleDescriptor, project, "ad hoc resolve"), JvmPlatforms.jvmPlatformByTargetVersion(jvmTarget),
|
||||
JvmPlatformCompilerServices, trace,
|
||||
JvmPlatformAnalyzerServices, trace,
|
||||
IDELanguageSettingsProvider.getLanguageVersionSettings(moduleInfo, project)
|
||||
)
|
||||
|
||||
|
||||
+15
-15
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.idea.core.isInTestSourceContentKotlinAware
|
||||
import org.jetbrains.kotlin.idea.framework.getLibraryPlatform
|
||||
import org.jetbrains.kotlin.idea.project.KotlinModuleModificationTracker
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.idea.project.findCompilerServices
|
||||
import org.jetbrains.kotlin.idea.project.findAnalyzerServices
|
||||
import org.jetbrains.kotlin.idea.project.getStableName
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
|
||||
import org.jetbrains.kotlin.idea.util.isInSourceContentWithoutInjected
|
||||
@@ -45,7 +45,7 @@ import org.jetbrains.kotlin.idea.util.rootManager
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.DefaultIdeTargetPlatformKindProvider
|
||||
import org.jetbrains.kotlin.platform.idePlatformKind
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.compat.toOldPlatform
|
||||
@@ -53,7 +53,7 @@ import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.platform.konan.isNative
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.util.*
|
||||
|
||||
@@ -163,8 +163,8 @@ interface ModuleSourceInfo : IdeaModuleInfo, TrackableModuleInfo {
|
||||
)
|
||||
fun getPlatform(): org.jetbrains.kotlin.resolve.TargetPlatform = platform.toOldPlatform()
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = platform.findCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = platform.findAnalyzerServices
|
||||
|
||||
override fun createModificationTracker(): ModificationTracker =
|
||||
KotlinModuleModificationTracker(module)
|
||||
@@ -308,8 +308,8 @@ open class LibraryInfo(val project: Project, val library: Library) : IdeaModuleI
|
||||
override val platform: TargetPlatform
|
||||
get() = getLibraryPlatform(project, library)
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = platform.findCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = platform.findAnalyzerServices
|
||||
|
||||
override val sourcesModuleInfo: SourceForBinaryModuleInfo
|
||||
get() = LibrarySourceInfo(project, library, this)
|
||||
@@ -344,8 +344,8 @@ data class LibrarySourceInfo(val project: Project, val library: Library, overrid
|
||||
override val platform: TargetPlatform
|
||||
get() = binariesModuleInfo.platform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = binariesModuleInfo.compilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = binariesModuleInfo.analyzerServices
|
||||
|
||||
override fun toString() = "LibrarySourceInfo(libraryName=${library.name})"
|
||||
}
|
||||
@@ -364,8 +364,8 @@ data class SdkInfo(val project: Project, val sdk: Sdk) : IdeaModuleInfo {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): provide proper target version
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
}
|
||||
|
||||
object NotUnderContentRootModuleInfo : IdeaModuleInfo {
|
||||
@@ -382,8 +382,8 @@ object NotUnderContentRootModuleInfo : IdeaModuleInfo {
|
||||
override val platform: TargetPlatform
|
||||
get() = DefaultIdeTargetPlatformKindProvider.defaultPlatform
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = platform.findCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = platform.findAnalyzerServices
|
||||
}
|
||||
|
||||
private class LibraryWithoutSourceScope(project: Project, private val library: Library) :
|
||||
@@ -473,8 +473,8 @@ data class PlatformModuleInfo(
|
||||
override val moduleOrigin: ModuleOrigin
|
||||
get() = platformModule.moduleOrigin
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = platform.findCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = platform.findAnalyzerServices
|
||||
|
||||
override fun dependencies() = platformModule.dependencies()
|
||||
|
||||
|
||||
+8
-9
@@ -14,11 +14,10 @@ import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDe
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.scripting.definitions.KotlinScriptDefinition
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
|
||||
data class ScriptModuleInfo(
|
||||
val project: Project,
|
||||
@@ -54,8 +53,8 @@ data class ScriptModuleInfo(
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper target version
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
}
|
||||
|
||||
sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, BinaryModuleInfo {
|
||||
@@ -80,8 +79,8 @@ sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, Bina
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
class ForFile(
|
||||
project: Project,
|
||||
@@ -135,8 +134,8 @@ sealed class ScriptDependenciesSourceInfo(val project: Project) : IdeaModuleInfo
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
|
||||
override val compilerServices: PlatformDependentCompilerServices
|
||||
get() = JvmPlatformCompilerServices
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
class ForProject(project: Project) : ScriptDependenciesSourceInfo(project)
|
||||
}
|
||||
+2
-2
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForLazyBodyResolve
|
||||
import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.idea.project.findCompilerServices
|
||||
import org.jetbrains.kotlin.idea.project.findAnalyzerServices
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
@@ -197,7 +197,7 @@ private object KotlinResolveDataProvider {
|
||||
trace,
|
||||
targetPlatform,
|
||||
bodyResolveCache,
|
||||
targetPlatform.findCompilerServices,
|
||||
targetPlatform.findAnalyzerServices,
|
||||
analyzableElement.languageVersionSettings
|
||||
).get<LazyTopDownAnalyzer>()
|
||||
|
||||
|
||||
@@ -718,7 +718,7 @@ class ResolveElementCache(
|
||||
trace,
|
||||
targetPlatform,
|
||||
statementFilter,
|
||||
targetPlatform.findCompilerServices,
|
||||
targetPlatform.findAnalyzerServices,
|
||||
file.languageVersionSettings
|
||||
).get()
|
||||
}
|
||||
|
||||
+9
-9
@@ -5,24 +5,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.project
|
||||
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.platform.konan.isNative
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
val TargetPlatform.findCompilerServices: PlatformDependentCompilerServices
|
||||
val TargetPlatform.findAnalyzerServices: PlatformDependentAnalyzerServices
|
||||
get() =
|
||||
when {
|
||||
isJvm() -> JvmPlatformCompilerServices
|
||||
isJs() -> JsPlatformCompilerServices
|
||||
isNative() -> NativePlatformCompilerServices
|
||||
isCommon() -> CommonPlatformCompilerServices
|
||||
isJvm() -> JvmPlatformAnalyzerServices
|
||||
isJs() -> JsPlatformAnalyzerServices
|
||||
isNative() -> NativePlatformAnalyzerServices
|
||||
isCommon() -> CommonPlatformAnalyzerServices
|
||||
else -> throw IllegalStateException("Unknown platform $this")
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.asJava.ImpreciseResolveResult.*
|
||||
import org.jetbrains.kotlin.idea.caches.project.getNullableModuleInfo
|
||||
import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.idea.project.findCompilerServices
|
||||
import org.jetbrains.kotlin.idea.project.findAnalyzerServices
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTypeAliasShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -259,7 +259,7 @@ class PsiBasedClassResolver @TestOnly constructor(private val targetClassFqName:
|
||||
|
||||
private fun KtFile.getDefaultImports(): List<ImportPath> {
|
||||
val moduleInfo = getNullableModuleInfo() ?: return emptyList()
|
||||
return TargetPlatformDetector.getPlatform(this).findCompilerServices.getDefaultImports(
|
||||
return TargetPlatformDetector.getPlatform(this).findAnalyzerServices.getDefaultImports(
|
||||
IDELanguageSettingsProvider.getLanguageVersionSettings(moduleInfo, project),
|
||||
includeLowPriorityImports = true
|
||||
)
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ide.konan.createPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService.Companion.createDeclarationProviderFactory
|
||||
|
||||
@@ -45,7 +45,7 @@ object NativeResolverForModuleFactory : ResolverForModuleFactory() {
|
||||
declarationProviderFactory,
|
||||
CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(),
|
||||
KonanPlatforms.defaultKonanPlatform,
|
||||
NativePlatformCompilerServices,
|
||||
NativePlatformAnalyzerServices,
|
||||
targetEnvironment,
|
||||
languageVersionSettings
|
||||
)
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.idea.inspections.collections
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.psi.qualifiedExpressionVisitor
|
||||
@@ -31,7 +31,7 @@ class SimplifiableCallChainInspection : AbstractCallChainChecker() {
|
||||
if (conversion.replacement.startsWith("joinTo")) {
|
||||
// Function parameter in map must have String result type
|
||||
if (!firstResolvedCall.hasLastFunctionalParameterWithResult(context) {
|
||||
it.isSubtypeOf(JsPlatformCompilerServices.builtIns.charSequence.defaultType)
|
||||
it.isSubtypeOf(JsPlatformAnalyzerServices.builtIns.charSequence.defaultType)
|
||||
}
|
||||
) return@check false
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.idea.analysis.analyzeInContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference
|
||||
import org.jetbrains.kotlin.idea.codeInliner.CodeToInline
|
||||
import org.jetbrains.kotlin.idea.codeInliner.CodeToInlineBuilder
|
||||
import org.jetbrains.kotlin.idea.project.findCompilerServices
|
||||
import org.jetbrains.kotlin.idea.project.findAnalyzerServices
|
||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
@@ -144,7 +144,7 @@ object ReplaceWithAnnotationAnalyzer {
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): List<ImportingScope> {
|
||||
val allDefaultImports =
|
||||
resolutionFacade.frontendService<TargetPlatform>().findCompilerServices.getDefaultImports(languageVersionSettings, includeLowPriorityImports = true)
|
||||
resolutionFacade.frontendService<TargetPlatform>().findAnalyzerServices.getDefaultImports(languageVersionSettings, includeLowPriorityImports = true)
|
||||
val (allUnderImports, aliasImports) = allDefaultImports.partition { it.isAllUnder }
|
||||
// this solution doesn't support aliased default imports with a different alias
|
||||
// TODO: Create import directives from ImportPath, create ImportResolver, create LazyResolverScope, see FileScopeProviderImpl
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.idea.imports.ImportPathComparator
|
||||
import org.jetbrains.kotlin.idea.imports.getImportableTargets
|
||||
import org.jetbrains.kotlin.idea.imports.importableFqName
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.idea.project.findCompilerServices
|
||||
import org.jetbrains.kotlin.idea.project.findAnalyzerServices
|
||||
import org.jetbrains.kotlin.idea.refactoring.fqName.isImported
|
||||
import org.jetbrains.kotlin.idea.resolve.frontendService
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -61,19 +61,19 @@ class ImportInsertHelperImpl(private val project: Project) : ImportInsertHelper(
|
||||
override fun isImportedWithDefault(importPath: ImportPath, contextFile: KtFile): Boolean {
|
||||
val languageVersionSettings = contextFile.getResolutionFacade().frontendService<LanguageVersionSettings>()
|
||||
val platform = TargetPlatformDetector.getPlatform(contextFile)
|
||||
val allDefaultImports = platform.findCompilerServices.getDefaultImports(languageVersionSettings, includeLowPriorityImports = true)
|
||||
val allDefaultImports = platform.findAnalyzerServices.getDefaultImports(languageVersionSettings, includeLowPriorityImports = true)
|
||||
|
||||
val scriptExtraImports = contextFile.takeIf { it.isScript() }?.let { ktFile ->
|
||||
val scriptDependencies = ScriptDependenciesProvider.getInstance(ktFile.project)?.getScriptDependencies(ktFile.originalFile)
|
||||
scriptDependencies?.imports?.map { ImportPath.fromString(it) }
|
||||
}.orEmpty()
|
||||
|
||||
return importPath.isImported(allDefaultImports + scriptExtraImports, platform.findCompilerServices.excludedImports)
|
||||
return importPath.isImported(allDefaultImports + scriptExtraImports, platform.findAnalyzerServices.excludedImports)
|
||||
}
|
||||
|
||||
override fun isImportedWithLowPriorityDefaultImport(importPath: ImportPath, contextFile: KtFile): Boolean {
|
||||
val platform = TargetPlatformDetector.getPlatform(contextFile)
|
||||
return importPath.isImported(platform.findCompilerServices.defaultLowPriorityImports, platform.findCompilerServices.excludedImports)
|
||||
return importPath.isImported(platform.findAnalyzerServices.defaultLowPriorityImports, platform.findAnalyzerServices.excludedImports)
|
||||
}
|
||||
|
||||
override fun mayImportOnShortenReferences(descriptor: DeclarationDescriptor): Boolean {
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.renderer.render
|
||||
import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
|
||||
fun Converter.convertImportList(importList: PsiImportList): ImportList {
|
||||
val imports = importList.allImportStatements
|
||||
@@ -160,7 +160,7 @@ private fun convertNonStaticImport(fqName: FqName, isOnDemand: Boolean, target:
|
||||
private fun renderImportName(fqName: FqName, isOnDemand: Boolean)
|
||||
= if (isOnDemand) fqName.render() + ".*" else fqName.render()
|
||||
|
||||
private val DEFAULT_IMPORTS_SET: Set<FqName> = JvmPlatformCompilerServices.getDefaultImports(
|
||||
private val DEFAULT_IMPORTS_SET: Set<FqName> = JvmPlatformAnalyzerServices.getDefaultImports(
|
||||
// TODO: use the correct LanguageVersionSettings instance here
|
||||
LanguageVersionSettingsImpl.DEFAULT,
|
||||
includeLowPriorityImports = true
|
||||
|
||||
@@ -29,11 +29,10 @@ import org.jetbrains.kotlin.frontend.di.configureModule
|
||||
import org.jetbrains.kotlin.frontend.di.configureStandardResolveComponents
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
import org.jetbrains.kotlin.types.SubstitutingScopeProviderImpl
|
||||
|
||||
@@ -46,11 +45,11 @@ fun createTopDownAnalyzerForJs(
|
||||
expectActualTracker: ExpectActualTracker,
|
||||
additionalPackages: List<PackageFragmentProvider>
|
||||
): LazyTopDownAnalyzer {
|
||||
val storageComponentContainer = createContainer("TopDownAnalyzerForJs", JsPlatformCompilerServices) {
|
||||
val storageComponentContainer = createContainer("TopDownAnalyzerForJs", JsPlatformAnalyzerServices) {
|
||||
configureModule(
|
||||
moduleContext,
|
||||
JsPlatforms.defaultJsPlatform,
|
||||
JsPlatformCompilerServices,
|
||||
JsPlatformAnalyzerServices,
|
||||
bindingTrace,
|
||||
languageVersionSettings
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.js.analyzer.JsAnalysisResult
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.js.resolve.MODULE_KIND
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -59,7 +59,7 @@ object TopDownAnalyzerFacadeForJS {
|
||||
val builtIns = when {
|
||||
thisIsBuiltInsModule -> DefaultBuiltIns(loadBuiltInsFromCurrentClassLoader = false)
|
||||
customBuiltInsModule != null -> customBuiltInsModule.builtIns
|
||||
else -> JsPlatformCompilerServices.builtIns
|
||||
else -> JsPlatformAnalyzerServices.builtIns
|
||||
}
|
||||
|
||||
val moduleName = configuration[CommonConfigurationKeys.MODULE_NAME]!!
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.config.*;
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker;
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices;
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.CompilerDeserializationConfiguration;
|
||||
import org.jetbrains.kotlin.serialization.js.*;
|
||||
@@ -251,7 +251,7 @@ public class JsConfig {
|
||||
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
|
||||
for (JsModuleDescriptor<KotlinJavaScriptLibraryParts> cached : metadataCache) {
|
||||
ModuleDescriptorImpl moduleDescriptor = new ModuleDescriptorImpl(
|
||||
Name.special("<" + cached.getName() + ">"), storageManager, JsPlatformCompilerServices.INSTANCE.getBuiltIns()
|
||||
Name.special("<" + cached.getName() + ">"), storageManager, JsPlatformAnalyzerServices.INSTANCE.getBuiltIns()
|
||||
);
|
||||
|
||||
KotlinJavaScriptLibraryParts parts = cached.getData();
|
||||
@@ -310,7 +310,7 @@ public class JsConfig {
|
||||
"Expected JS metadata version " + JsMetadataVersion.INSTANCE + ", but actual metadata version is " + m.getVersion();
|
||||
|
||||
ModuleDescriptorImpl moduleDescriptor = new ModuleDescriptorImpl(
|
||||
Name.special("<" + m.getModuleName() + ">"), storageManager, JsPlatformCompilerServices.INSTANCE.getBuiltIns()
|
||||
Name.special("<" + m.getModuleName() + ">"), storageManager, JsPlatformAnalyzerServices.INSTANCE.getBuiltIns()
|
||||
);
|
||||
|
||||
LookupTracker lookupTracker = configuration.get(CommonConfigurationKeys.LOOKUP_TRACKER, LookupTracker.DO_NOTHING.INSTANCE);
|
||||
@@ -327,6 +327,6 @@ public class JsConfig {
|
||||
}
|
||||
|
||||
private static void setDependencies(ModuleDescriptorImpl module, List<ModuleDescriptorImpl> modules) {
|
||||
module.setDependencies(CollectionsKt.plus(modules, JsPlatformCompilerServices.INSTANCE.getBuiltIns().getBuiltInsModule()));
|
||||
module.setDependencies(CollectionsKt.plus(modules, JsPlatformAnalyzerServices.INSTANCE.getBuiltIns().getBuiltInsModule()));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
object JsPlatformCompilerServices : PlatformDependentCompilerServices() {
|
||||
object JsPlatformAnalyzerServices : PlatformDependentAnalyzerServices() {
|
||||
override fun computePlatformSpecificDefaultImports(storageManager: StorageManager, result: MutableList<ImportPath>) {
|
||||
result.add(ImportPath.fromString("kotlin.js.*"))
|
||||
}
|
||||
@@ -13,8 +13,6 @@ import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForLazyResolve
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
@@ -48,7 +46,7 @@ object JsResolverForModuleFactory : ResolverForModuleFactory() {
|
||||
declarationProviderFactory,
|
||||
BindingTraceContext(/* allowSliceRewrite = */ true),
|
||||
moduleDescriptor.platform!!,
|
||||
JsPlatformCompilerServices,
|
||||
JsPlatformAnalyzerServices,
|
||||
targetEnvironment,
|
||||
languageVersionSettings
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.js.backend.ast.metadata.TypeCheck;
|
||||
import org.jetbrains.kotlin.js.config.JsConfig;
|
||||
import org.jetbrains.kotlin.js.naming.NameSuggestion;
|
||||
import org.jetbrains.kotlin.js.naming.SuggestedName;
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformCompilerServices;
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices;
|
||||
import org.jetbrains.kotlin.js.translate.intrinsic.functions.factories.ArrayFIF;
|
||||
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils;
|
||||
import org.jetbrains.kotlin.js.translate.utils.JsDescriptorUtils;
|
||||
@@ -57,8 +57,8 @@ public final class Namer {
|
||||
public static final String KOTLIN_NAME = KotlinLanguage.NAME;
|
||||
public static final String KOTLIN_LOWER_NAME = KOTLIN_NAME.toLowerCase();
|
||||
|
||||
public static final String EQUALS_METHOD_NAME = getStableMangledNameForDescriptor(JsPlatformCompilerServices.INSTANCE.getBuiltIns().getAny(), "equals");
|
||||
public static final String COMPARE_TO_METHOD_NAME = getStableMangledNameForDescriptor(JsPlatformCompilerServices.INSTANCE.getBuiltIns().getComparable(), "compareTo");
|
||||
public static final String EQUALS_METHOD_NAME = getStableMangledNameForDescriptor(JsPlatformAnalyzerServices.INSTANCE.getBuiltIns().getAny(), "equals");
|
||||
public static final String COMPARE_TO_METHOD_NAME = getStableMangledNameForDescriptor(JsPlatformAnalyzerServices.INSTANCE.getBuiltIns().getComparable(), "compareTo");
|
||||
public static final String LONG_FROM_NUMBER = "fromNumber";
|
||||
public static final String LONG_TO_NUMBER = "toNumber";
|
||||
public static final String LONG_FROM_INT = "fromInt";
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.resolve.konan.platform
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
object NativePlatformCompilerServices : PlatformDependentCompilerServices() {
|
||||
object NativePlatformAnalyzerServices : PlatformDependentAnalyzerServices() {
|
||||
override fun computePlatformSpecificDefaultImports(storageManager: StorageManager, result: MutableList<ImportPath>) {
|
||||
result.add(ImportPath.fromString("kotlin.native.*"))
|
||||
}
|
||||
Reference in New Issue
Block a user