Consistent naming: common platform is common, not default
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.metadata
|
||||
|
||||
import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade
|
||||
import org.jetbrains.kotlin.builtins.BuiltInsBinaryVersion
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
|
||||
@@ -64,7 +64,7 @@ open class MetadataSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
|
||||
val analyzer = AnalyzerWithCompilerReport(messageCollector)
|
||||
analyzer.analyzeAndReport(files) {
|
||||
DefaultAnalyzerFacade.analyzeFiles(files, moduleName, dependOnOldBuiltIns, configuration.languageVersionSettings) { _, content ->
|
||||
CommonAnalyzerFacade.analyzeFiles(files, moduleName, dependOnOldBuiltIns, configuration.languageVersionSettings) { _, content ->
|
||||
environment.createPackagePartProvider(content.moduleContentScope)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.*
|
||||
object JvmPlatform : TargetPlatform("JVM") {
|
||||
private val defaultImports = LockBasedStorageManager().createMemoizedFunction<Boolean, List<ImportPath>> { includeKotlinComparisons ->
|
||||
ArrayList<ImportPath>().apply {
|
||||
addAll(Default.getDefaultImports(includeKotlinComparisons))
|
||||
addAll(Common.getDefaultImports(includeKotlinComparisons))
|
||||
|
||||
add(ImportPath.fromString("java.lang.*"))
|
||||
add(ImportPath.fromString("kotlin.jvm.*"))
|
||||
|
||||
@@ -234,7 +234,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 =
|
||||
if (platform == TargetPlatform.Default)
|
||||
if (platform == TargetPlatform.Common)
|
||||
ModuleInfo.DependencyOnBuiltIns.AFTER_SDK
|
||||
else
|
||||
ModuleInfo.DependencyOnBuiltIns.LAST
|
||||
|
||||
+4
-4
@@ -46,9 +46,9 @@ import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragmen
|
||||
|
||||
/**
|
||||
* A facade that is used to analyze common (platform-independent) modules in multi-platform projects.
|
||||
* See [TargetPlatform.Default]
|
||||
* See [TargetPlatform.Common]
|
||||
*/
|
||||
object DefaultAnalyzerFacade : AnalyzerFacade() {
|
||||
object CommonAnalyzerFacade : AnalyzerFacade() {
|
||||
private class SourceModuleInfo(
|
||||
override val name: Name,
|
||||
override val capabilities: Map<ModuleDescriptor.Capability<*>, Any?>,
|
||||
@@ -77,7 +77,7 @@ object DefaultAnalyzerFacade : AnalyzerFacade() {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val resolver = ResolverForProjectImpl (
|
||||
"sources for metadata serializer",
|
||||
ProjectContext(project), listOf(moduleInfo), { DefaultAnalyzerFacade },
|
||||
ProjectContext(project), listOf(moduleInfo), { CommonAnalyzerFacade },
|
||||
{ ModuleContent(files, GlobalSearchScope.allScope(project)) },
|
||||
object : PlatformAnalysisParameters {},
|
||||
languageSettingsProvider = object : LanguageSettingsProvider {
|
||||
@@ -159,5 +159,5 @@ object DefaultAnalyzerFacade : AnalyzerFacade() {
|
||||
}
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
get() = TargetPlatform.Default
|
||||
get() = TargetPlatform.Common
|
||||
}
|
||||
@@ -170,7 +170,7 @@ fun createLazyResolveSession(moduleContext: ModuleContext, files: Collection<KtF
|
||||
moduleContext,
|
||||
FileBasedDeclarationProviderFactory(moduleContext.storageManager, files),
|
||||
BindingTraceContext(),
|
||||
TargetPlatform.Default,
|
||||
TargetPlatform.Common,
|
||||
TargetPlatformVersion.NoVersion,
|
||||
CompilerEnvironment,
|
||||
LanguageVersionSettingsImpl.DEFAULT
|
||||
|
||||
@@ -39,7 +39,7 @@ abstract class TargetPlatform(val platformName: String) {
|
||||
|
||||
abstract val multiTargetPlatform: MultiTargetPlatform
|
||||
|
||||
object Default : TargetPlatform("Default") {
|
||||
object Common : TargetPlatform("Default") {
|
||||
private val defaultImports = LockBasedStorageManager().createMemoizedFunction<Boolean, List<ImportPath>> {
|
||||
includeKotlinComparisons ->
|
||||
ArrayList<ImportPath>().apply {
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
|
||||
import org.jetbrains.kotlin.config.*
|
||||
@@ -293,7 +293,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
|
||||
val platform = moduleDescriptor.getMultiTargetPlatform()
|
||||
if (platform == MultiTargetPlatform.Common) {
|
||||
return DefaultAnalyzerFacade.analyzeFiles(
|
||||
return CommonAnalyzerFacade.analyzeFiles(
|
||||
files, moduleDescriptor.name, true, languageVersionSettings,
|
||||
mapOf(
|
||||
MultiTargetPlatform.CAPABILITY to MultiTargetPlatform.Common,
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind
|
||||
import org.jetbrains.kotlin.analyzer.AnalyzerFacade
|
||||
import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade
|
||||
import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||
@@ -107,10 +107,10 @@ class JsPlatformSupport : IdePlatformSupport() {
|
||||
|
||||
class CommonPlatformSupport : IdePlatformSupport() {
|
||||
override val platform: TargetPlatform
|
||||
get() = TargetPlatform.Default
|
||||
get() = TargetPlatform.Common
|
||||
|
||||
override val analyzerFacade: AnalyzerFacade
|
||||
get() = DefaultAnalyzerFacade
|
||||
get() = CommonAnalyzerFacade
|
||||
|
||||
override val libraryKind: PersistentLibraryKind<*>?
|
||||
get() = CommonLibraryKind
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ class LibraryDependenciesCacheImpl(private val project: Project) : LibraryDepend
|
||||
* @return true if it's OK to add a dependency from a library with platform [from] to a library with platform [to]
|
||||
*/
|
||||
private fun compatiblePlatforms(from: TargetPlatform, to: TargetPlatform): Boolean {
|
||||
return from == to || to == TargetPlatform.Default
|
||||
return from == to || to == TargetPlatform.Common
|
||||
}
|
||||
|
||||
private fun getLibraryUsageIndex(): LibraryUsageIndex {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragmen
|
||||
import java.io.ByteArrayInputStream
|
||||
|
||||
class KotlinBuiltInDecompiler : KotlinMetadataDecompiler<BuiltInsBinaryVersion>(
|
||||
KotlinBuiltInFileType, TargetPlatform.Default, BuiltInSerializerProtocol,
|
||||
KotlinBuiltInFileType, TargetPlatform.Common, BuiltInSerializerProtocol,
|
||||
FlexibleTypeDeserializer.ThrowException, BuiltInsBinaryVersion.INSTANCE, BuiltInsBinaryVersion.INVALID_VERSION,
|
||||
KotlinStubVersions.BUILTIN_STUB_VERSION
|
||||
) {
|
||||
|
||||
@@ -59,7 +59,7 @@ fun getLibraryPlatform(library: Library): TargetPlatform {
|
||||
|
||||
return when (library.kind) {
|
||||
JSLibraryKind -> JsPlatform
|
||||
CommonLibraryKind -> TargetPlatform.Default
|
||||
CommonLibraryKind -> TargetPlatform.Common
|
||||
else -> JvmPlatform
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class PlatformHeaderAnnotator : Annotator {
|
||||
val declaration = element as? KtDeclaration ?: return
|
||||
if (!isHeaderDeclaration(declaration)) return
|
||||
|
||||
if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Default) return
|
||||
if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Common) return
|
||||
|
||||
val implementingModules = declaration.findModuleDescriptor().allImplementingCompatibleModules
|
||||
if (implementingModules.isEmpty()) return
|
||||
|
||||
+2
-2
@@ -144,7 +144,7 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase<Kot
|
||||
if (!targetClass.languageVersionSettings.supportsFeature(LanguageFeature.BoundCallableReferences)) return defaultExpression
|
||||
return when (targetClass.platform) {
|
||||
is JsPlatform -> "other == null || this::class.js != $paramName::class.js"
|
||||
is TargetPlatform.Default -> "other == null || this::class != $paramName::class"
|
||||
is TargetPlatform.Common -> "other == null || this::class != $paramName::class"
|
||||
else -> defaultExpression
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase<Kot
|
||||
if (!targetClass.languageVersionSettings.supportsFeature(LanguageFeature.BoundCallableReferences)) return defaultExpression
|
||||
return when (targetClass.platform) {
|
||||
is JsPlatform -> "this::class.js"
|
||||
is TargetPlatform.Default -> "this::class"
|
||||
is TargetPlatform.Common -> "this::class"
|
||||
else -> defaultExpression
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
||||
val targetPlatform = when (targetPlatformName) {
|
||||
"JVM" -> JvmPlatform
|
||||
"JavaScript" -> JsPlatform
|
||||
"Common" -> TargetPlatform.Default
|
||||
"Common" -> TargetPlatform.Common
|
||||
else -> error("Unexpected platform name: $targetPlatformName")
|
||||
}
|
||||
mainPsiFile.targetPlatform = targetPlatform
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
|
||||
object JsPlatform : TargetPlatform("JS") {
|
||||
private val defaultImports = LockBasedStorageManager().createMemoizedFunction<Boolean, List<ImportPath>> { includeKotlinComparisons ->
|
||||
Default.getDefaultImports(includeKotlinComparisons) + ImportPath.fromString("kotlin.js.*")
|
||||
Common.getDefaultImports(includeKotlinComparisons) + ImportPath.fromString("kotlin.js.*")
|
||||
}
|
||||
|
||||
override fun getDefaultImports(includeKotlinComparisons: Boolean): List<ImportPath> = defaultImports(includeKotlinComparisons)
|
||||
|
||||
Reference in New Issue
Block a user