Multi-platform refactoring: get rid of PlatformKind (replace with MultiTargetPlatform)
This commit is contained in:
+3
-2
@@ -56,6 +56,7 @@ import org.jetbrains.kotlin.platform.JvmBuiltIns
|
|||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||||
import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer
|
import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.TopDownAnalysisMode
|
import org.jetbrains.kotlin.resolve.TopDownAnalysisMode
|
||||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
|
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
|
||||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
||||||
@@ -150,7 +151,7 @@ object TopDownAnalyzerFacadeForJVM {
|
|||||||
val dependencyModule = if (separateModules) {
|
val dependencyModule = if (separateModules) {
|
||||||
val dependenciesContext = ContextForNewModule(
|
val dependenciesContext = ContextForNewModule(
|
||||||
moduleContext, Name.special("<dependencies of ${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>"),
|
moduleContext, Name.special("<dependencies of ${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>"),
|
||||||
module.builtIns
|
module.builtIns, null
|
||||||
)
|
)
|
||||||
|
|
||||||
// Scope for the dependency module contains everything except files present in the scope for the source module
|
// Scope for the dependency module contains everything except files present in the scope for the source module
|
||||||
@@ -261,7 +262,7 @@ object TopDownAnalyzerFacadeForJVM {
|
|||||||
val projectContext = ProjectContext(project)
|
val projectContext = ProjectContext(project)
|
||||||
val builtIns = JvmBuiltIns(projectContext.storageManager, !createBuiltInsFromModule)
|
val builtIns = JvmBuiltIns(projectContext.storageManager, !createBuiltInsFromModule)
|
||||||
return ContextForNewModule(
|
return ContextForNewModule(
|
||||||
projectContext, Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>"), builtIns
|
projectContext, Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>"), builtIns, null
|
||||||
).apply {
|
).apply {
|
||||||
if (createBuiltInsFromModule) {
|
if (createBuiltInsFromModule) {
|
||||||
builtIns.builtInsModule = module
|
builtIns.builtInsModule = module
|
||||||
|
|||||||
@@ -16,12 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.jvm.platform
|
package org.jetbrains.kotlin.resolve.jvm.platform
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PlatformKind
|
|
||||||
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.*
|
||||||
import org.jetbrains.kotlin.resolve.ImportPath
|
|
||||||
import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||||
@@ -49,6 +45,5 @@ object JvmPlatform : TargetPlatform("JVM") {
|
|||||||
|
|
||||||
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
|
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
|
||||||
|
|
||||||
override val kind: PlatformKind
|
override val multiTargetPlatform = MultiTargetPlatform.Specific(platformName)
|
||||||
get() = PlatformKind.JVM
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.name.FqName
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||||
@@ -159,7 +160,7 @@ abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
|||||||
delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
|
delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
|
||||||
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { _, _ -> PackagePartProvider.Empty },
|
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { _, _ -> PackagePartProvider.Empty },
|
||||||
firstDependency: M? = null,
|
firstDependency: M? = null,
|
||||||
modulePlatforms: (M) -> PlatformKind = { PlatformKind.DEFAULT },
|
modulePlatforms: (M) -> MultiTargetPlatform?,
|
||||||
moduleSources: (M) -> SourceKind = { SourceKind.NONE }
|
moduleSources: (M) -> SourceKind = { SourceKind.NONE }
|
||||||
): ResolverForProject<M> {
|
): ResolverForProject<M> {
|
||||||
val storageManager = projectContext.storageManager
|
val storageManager = projectContext.storageManager
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ object DefaultAnalyzerFacade : AnalyzerFacade<PlatformAnalysisParameters>() {
|
|||||||
ProjectContext(project), listOf(moduleInfo),
|
ProjectContext(project), listOf(moduleInfo),
|
||||||
{ ModuleContent(files, GlobalSearchScope.allScope(project)) },
|
{ ModuleContent(files, GlobalSearchScope.allScope(project)) },
|
||||||
object : PlatformAnalysisParameters {},
|
object : PlatformAnalysisParameters {},
|
||||||
packagePartProviderFactory = packagePartProviderFactory
|
packagePartProviderFactory = packagePartProviderFactory,
|
||||||
|
modulePlatforms = { MultiTargetPlatform.Common }
|
||||||
)
|
)
|
||||||
|
|
||||||
val moduleDescriptor = resolver.descriptorForModule(moduleInfo)
|
val moduleDescriptor = resolver.descriptorForModule(moduleInfo)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.storage.ExceptionTracker
|
import org.jetbrains.kotlin.storage.ExceptionTracker
|
||||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
@@ -94,8 +95,14 @@ fun ModuleContext(module: ModuleDescriptor, project: Project): ModuleContext =
|
|||||||
fun GlobalContext.withProject(project: Project): ProjectContext = ProjectContextImpl(project, this)
|
fun GlobalContext.withProject(project: Project): ProjectContext = ProjectContextImpl(project, this)
|
||||||
fun ProjectContext.withModule(module: ModuleDescriptor): ModuleContext = ModuleContextImpl(module, this)
|
fun ProjectContext.withModule(module: ModuleDescriptor): ModuleContext = ModuleContextImpl(module, this)
|
||||||
|
|
||||||
fun ContextForNewModule(projectContext: ProjectContext, moduleName: Name, builtIns: KotlinBuiltIns): MutableModuleContext {
|
@JvmOverloads
|
||||||
val module = ModuleDescriptorImpl(moduleName, projectContext.storageManager, builtIns)
|
fun ContextForNewModule(
|
||||||
|
projectContext: ProjectContext,
|
||||||
|
moduleName: Name,
|
||||||
|
builtIns: KotlinBuiltIns,
|
||||||
|
multiTargetPlatform: MultiTargetPlatform?
|
||||||
|
): MutableModuleContext {
|
||||||
|
val module = ModuleDescriptorImpl(moduleName, projectContext.storageManager, builtIns, multiTargetPlatform)
|
||||||
return MutableModuleContextImpl(module, projectContext)
|
return MutableModuleContextImpl(module, projectContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
|||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.*
|
import org.jetbrains.kotlin.resolve.calls.inference.*
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.Bound
|
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.Bound
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.BoundKind.LOWER_BOUND
|
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.BoundKind.LOWER_BOUND
|
||||||
@@ -42,6 +43,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.Constrain
|
|||||||
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.*
|
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.*
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.getValidityConstraintForConstituentType
|
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.getValidityConstraintForConstituentType
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
@@ -74,7 +76,12 @@ object Renderers {
|
|||||||
@JvmField val NAME = Renderer<Named> { it.name.asString() }
|
@JvmField val NAME = Renderer<Named> { it.name.asString() }
|
||||||
|
|
||||||
@JvmField val PLATFORM = Renderer<ModuleDescriptor> {
|
@JvmField val PLATFORM = Renderer<ModuleDescriptor> {
|
||||||
if (it.platformKind == PlatformKind.DEFAULT) "" else " for " + it.platformKind.name
|
val platform = it.getMultiTargetPlatform()
|
||||||
|
when (platform) {
|
||||||
|
MultiTargetPlatform.Common -> ""
|
||||||
|
is MultiTargetPlatform.Specific -> " for " + platform.platform
|
||||||
|
null -> ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmField val VISIBILITY = Renderer<Visibility> {
|
@JvmField val VISIBILITY = Renderer<Visibility> {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve
|
|||||||
import org.jetbrains.kotlin.container.StorageComponentContainer
|
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||||
import org.jetbrains.kotlin.container.composeContainer
|
import org.jetbrains.kotlin.container.composeContainer
|
||||||
import org.jetbrains.kotlin.container.useInstance
|
import org.jetbrains.kotlin.container.useInstance
|
||||||
import org.jetbrains.kotlin.descriptors.PlatformKind
|
|
||||||
import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap
|
import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap
|
||||||
import org.jetbrains.kotlin.resolve.calls.checkers.*
|
import org.jetbrains.kotlin.resolve.calls.checkers.*
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||||
@@ -36,7 +35,7 @@ abstract class TargetPlatform(val platformName: String) {
|
|||||||
abstract val platformConfigurator: PlatformConfigurator
|
abstract val platformConfigurator: PlatformConfigurator
|
||||||
abstract val defaultImports: List<ImportPath>
|
abstract val defaultImports: List<ImportPath>
|
||||||
|
|
||||||
abstract val kind: PlatformKind
|
abstract val multiTargetPlatform: MultiTargetPlatform
|
||||||
|
|
||||||
object Default : TargetPlatform("Default") {
|
object Default : TargetPlatform("Default") {
|
||||||
override val defaultImports: List<ImportPath> = ArrayList<ImportPath>().apply {
|
override val defaultImports: List<ImportPath> = ArrayList<ImportPath>().apply {
|
||||||
@@ -61,8 +60,8 @@ abstract class TargetPlatform(val platformName: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val kind: PlatformKind
|
override val multiTargetPlatform: MultiTargetPlatform
|
||||||
get() = PlatformKind.DEFAULT
|
get() = MultiTargetPlatform.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -474,13 +474,9 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() {
|
|||||||
val platform =
|
val platform =
|
||||||
if (nameSuffix.isEmpty()) null
|
if (nameSuffix.isEmpty()) null
|
||||||
else if (nameSuffix == "common") MultiTargetPlatform.Common else MultiTargetPlatform.Specific(nameSuffix.toUpperCase())
|
else if (nameSuffix == "common") MultiTargetPlatform.Common else MultiTargetPlatform.Specific(nameSuffix.toUpperCase())
|
||||||
val capabilities: Map<ModuleDescriptor.Capability<*>, Any?> =
|
|
||||||
if (platform == null) emptyMap()
|
|
||||||
else mapOf(MultiTargetPlatform.CAPABILITY to platform)
|
|
||||||
return ModuleDescriptorImpl(
|
return ModuleDescriptorImpl(
|
||||||
Name.special("<$moduleName>"), storageManager, JvmBuiltIns(storageManager),
|
Name.special("<$moduleName>"), storageManager, JvmBuiltIns(storageManager),
|
||||||
if (platform == MultiTargetPlatform.Common) PlatformKind.DEFAULT else PlatformKind.JVM,
|
platform, SourceKind.TEST
|
||||||
SourceKind.TEST, capabilities
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.container.get
|
|||||||
import org.jetbrains.kotlin.context.ProjectContext
|
import org.jetbrains.kotlin.context.ProjectContext
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
||||||
|
|
||||||
@@ -38,7 +39,8 @@ fun createResolveSessionForFiles(
|
|||||||
"test",
|
"test",
|
||||||
projectContext, listOf(testModule),
|
projectContext, listOf(testModule),
|
||||||
{ ModuleContent(syntheticFiles, GlobalSearchScope.allScope(project)) },
|
{ ModuleContent(syntheticFiles, GlobalSearchScope.allScope(project)) },
|
||||||
JvmPlatformParameters { testModule }
|
JvmPlatformParameters { testModule },
|
||||||
|
modulePlatforms = { MultiTargetPlatform.Specific("JVM") }
|
||||||
)
|
)
|
||||||
return resolverForProject.resolverForModule(testModule).componentProvider.get<ResolveSession>()
|
return resolverForProject.resolverForModule(testModule).componentProvider.get<ResolveSession>()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.name.FqName
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
||||||
@@ -73,7 +74,8 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
|||||||
val moduleName = javaClass.name.asString().toLowerCase().first().toString()
|
val moduleName = javaClass.name.asString().toLowerCase().first().toString()
|
||||||
modules.first { it._name == moduleName }
|
modules.first { it._name == moduleName }
|
||||||
},
|
},
|
||||||
builtIns = builtIns
|
builtIns = builtIns,
|
||||||
|
modulePlatforms = { MultiTargetPlatform.Specific("JVM") }
|
||||||
)
|
)
|
||||||
|
|
||||||
builtIns.initialize(
|
builtIns.initialize(
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public abstract class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void createBuiltInsModule() {
|
protected void createBuiltInsModule() {
|
||||||
builtInsModule = new ModuleDescriptorImpl(BUILTINS_MODULE_NAME, storageManager, this);
|
builtInsModule = new ModuleDescriptorImpl(BUILTINS_MODULE_NAME, storageManager, this, null);
|
||||||
PackageFragmentProvider packageFragmentProvider = BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
|
PackageFragmentProvider packageFragmentProvider = BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
|
||||||
storageManager, builtInsModule, BUILT_INS_PACKAGE_FQ_NAMES,
|
storageManager, builtInsModule, BUILT_INS_PACKAGE_FQ_NAMES,
|
||||||
getClassDescriptorFactories(),
|
getClassDescriptorFactories(),
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ interface ModuleDescriptor : DeclarationDescriptor {
|
|||||||
|
|
||||||
val builtIns: KotlinBuiltIns
|
val builtIns: KotlinBuiltIns
|
||||||
|
|
||||||
val platformKind: PlatformKind
|
|
||||||
|
|
||||||
val sourceKind: SourceKind
|
val sourceKind: SourceKind
|
||||||
|
|
||||||
fun shouldSeeInternalsOf(targetModule: ModuleDescriptor): Boolean
|
fun shouldSeeInternalsOf(targetModule: ModuleDescriptor): Boolean
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.descriptors
|
|
||||||
|
|
||||||
enum class PlatformKind {
|
|
||||||
DEFAULT,
|
|
||||||
JVM,
|
|
||||||
JS
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,8 @@ import org.jetbrains.kotlin.descriptors.*
|
|||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.utils.sure
|
import org.jetbrains.kotlin.utils.sure
|
||||||
import java.lang.IllegalArgumentException
|
import java.lang.IllegalArgumentException
|
||||||
@@ -29,9 +31,10 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
|
|||||||
moduleName: Name,
|
moduleName: Name,
|
||||||
private val storageManager: StorageManager,
|
private val storageManager: StorageManager,
|
||||||
override val builtIns: KotlinBuiltIns,
|
override val builtIns: KotlinBuiltIns,
|
||||||
override val platformKind: PlatformKind = PlatformKind.DEFAULT,
|
// May be null in compiler context, should be not-null in IDE context
|
||||||
|
multiTargetPlatform: MultiTargetPlatform? = null,
|
||||||
override val sourceKind: SourceKind = SourceKind.NONE,
|
override val sourceKind: SourceKind = SourceKind.NONE,
|
||||||
private val capabilities: Map<ModuleDescriptor.Capability<*>, Any?> = emptyMap()
|
capabilities: Map<ModuleDescriptor.Capability<*>, Any?> = emptyMap()
|
||||||
) : DeclarationDescriptorImpl(Annotations.EMPTY, moduleName), ModuleDescriptor {
|
) : DeclarationDescriptorImpl(Annotations.EMPTY, moduleName), ModuleDescriptor {
|
||||||
init {
|
init {
|
||||||
if (!moduleName.isSpecial) {
|
if (!moduleName.isSpecial) {
|
||||||
@@ -39,6 +42,8 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val capabilities = capabilities + (multiTargetPlatform?.let { mapOf(MultiTargetPlatform.CAPABILITY to it) } ?: emptyMap())
|
||||||
|
|
||||||
private var dependencies: ModuleDependencies? = null
|
private var dependencies: ModuleDependencies? = null
|
||||||
private var packageFragmentProviderForModuleContent: PackageFragmentProvider? = null
|
private var packageFragmentProviderForModuleContent: PackageFragmentProvider? = null
|
||||||
|
|
||||||
@@ -81,9 +86,9 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
|
|||||||
fun setDependencies(dependencies: ModuleDependencies) {
|
fun setDependencies(dependencies: ModuleDependencies) {
|
||||||
assert(this.dependencies == null) { "Dependencies of $id were already set" }
|
assert(this.dependencies == null) { "Dependencies of $id were already set" }
|
||||||
this.dependencies = dependencies
|
this.dependencies = dependencies
|
||||||
if (platformKind == PlatformKind.DEFAULT) return
|
if (getMultiTargetPlatform() == MultiTargetPlatform.Common) return
|
||||||
for (dependencyModule in allDependencyModules) {
|
for (dependencyModule in allDependencyModules) {
|
||||||
if (dependencyModule.platformKind != PlatformKind.DEFAULT) continue
|
if (dependencyModule.getMultiTargetPlatform() != MultiTargetPlatform.Common) continue
|
||||||
if (dependencyModule.sourceKind != sourceKind) continue
|
if (dependencyModule.sourceKind != sourceKind) continue
|
||||||
(dependencyModule as? ModuleDescriptorImpl)?.allImplementingModules?.add(this)
|
(dependencyModule as? ModuleDescriptorImpl)?.allImplementingModules?.add(this)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -50,12 +50,6 @@ public class ErrorUtils {
|
|||||||
private static final ModuleDescriptor ERROR_MODULE;
|
private static final ModuleDescriptor ERROR_MODULE;
|
||||||
static {
|
static {
|
||||||
ERROR_MODULE = new ModuleDescriptor() {
|
ERROR_MODULE = new ModuleDescriptor() {
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public PlatformKind getPlatformKind() {
|
|
||||||
return PlatformKind.DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public SourceKind getSourceKind() {
|
public SourceKind getSourceKind() {
|
||||||
|
|||||||
+2
-2
@@ -29,13 +29,13 @@ import org.jetbrains.kotlin.analyzer.ResolverForProject
|
|||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.context.GlobalContextImpl
|
import org.jetbrains.kotlin.context.GlobalContextImpl
|
||||||
import org.jetbrains.kotlin.context.withProject
|
import org.jetbrains.kotlin.context.withProject
|
||||||
import org.jetbrains.kotlin.descriptors.PlatformKind
|
|
||||||
import org.jetbrains.kotlin.descriptors.SourceKind
|
import org.jetbrains.kotlin.descriptors.SourceKind
|
||||||
import org.jetbrains.kotlin.idea.project.IdeaEnvironment
|
import org.jetbrains.kotlin.idea.project.IdeaEnvironment
|
||||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||||
import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
|
import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
||||||
|
|
||||||
fun createModuleResolverProvider(
|
fun createModuleResolverProvider(
|
||||||
@@ -78,7 +78,7 @@ fun createModuleResolverProvider(
|
|||||||
sdk?.let { SdkInfo(project, it) },
|
sdk?.let { SdkInfo(project, it) },
|
||||||
modulePlatforms = { moduleInfo ->
|
modulePlatforms = { moduleInfo ->
|
||||||
val module = (moduleInfo as? ModuleSourceInfo)?.module
|
val module = (moduleInfo as? ModuleSourceInfo)?.module
|
||||||
module?.let { TargetPlatformDetector.getPlatform(module).kind } ?: PlatformKind.DEFAULT
|
module?.let { TargetPlatformDetector.getPlatform(module).multiTargetPlatform }
|
||||||
},
|
},
|
||||||
moduleSources = { moduleInfo ->
|
moduleSources = { moduleInfo ->
|
||||||
when (moduleInfo) {
|
when (moduleInfo) {
|
||||||
|
|||||||
+1
-1
@@ -236,7 +236,7 @@ public class SourceNavigationHelper {
|
|||||||
@NotNull Project project
|
@NotNull Project project
|
||||||
) {
|
) {
|
||||||
MutableModuleContext newModuleContext = ContextKt.ContextForNewModule(
|
MutableModuleContext newModuleContext = ContextKt.ContextForNewModule(
|
||||||
ContextKt.ProjectContext(project), Name.special("<library module>"), DefaultBuiltIns.getInstance()
|
ContextKt.ProjectContext(project), Name.special("<library module>"), DefaultBuiltIns.getInstance(), null
|
||||||
);
|
);
|
||||||
|
|
||||||
newModuleContext.setDependencies(newModuleContext.getModule(), newModuleContext.getModule().getBuiltIns().getBuiltInsModule());
|
newModuleContext.setDependencies(newModuleContext.getModule(), newModuleContext.getModule().getBuiltIns().getBuiltInsModule());
|
||||||
|
|||||||
+2
-3
@@ -22,7 +22,6 @@ import com.intellij.psi.PsiElement
|
|||||||
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
||||||
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PlatformKind
|
|
||||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor
|
import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor
|
||||||
@@ -30,6 +29,7 @@ import org.jetbrains.kotlin.idea.core.toDescriptor
|
|||||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
||||||
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics
|
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics
|
||||||
import org.jetbrains.kotlin.resolve.diagnostics.SimpleDiagnostics
|
import org.jetbrains.kotlin.resolve.diagnostics.SimpleDiagnostics
|
||||||
@@ -40,8 +40,7 @@ class PlatformHeaderAnnotator : Annotator {
|
|||||||
val declaration = element as? KtDeclaration ?: return
|
val declaration = element as? KtDeclaration ?: return
|
||||||
if (!declaration.hasModifier(KtTokens.HEADER_KEYWORD)) return
|
if (!declaration.hasModifier(KtTokens.HEADER_KEYWORD)) return
|
||||||
|
|
||||||
val platform = TargetPlatformDetector.getPlatform(declaration.containingKtFile)
|
if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Default) return
|
||||||
if (platform.kind != PlatformKind.DEFAULT) return
|
|
||||||
|
|
||||||
val defaultModuleDescriptor = declaration.findModuleDescriptor()
|
val defaultModuleDescriptor = declaration.findModuleDescriptor()
|
||||||
val dependentDescriptors = defaultModuleDescriptor.allImplementingModules
|
val dependentDescriptors = defaultModuleDescriptor.allImplementingModules
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor
|
|||||||
import org.jetbrains.kotlin.idea.core.toDescriptor
|
import org.jetbrains.kotlin.idea.core.toDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
||||||
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
|
|
||||||
fun ModuleDescriptor.commonModuleOrNull() = allDependencyModules.filter {
|
fun ModuleDescriptor.commonModuleOrNull() = allDependencyModules.filter {
|
||||||
it.platformKind == PlatformKind.DEFAULT && it.sourceKind == sourceKind
|
it.getMultiTargetPlatform() == MultiTargetPlatform.Common && it.sourceKind == sourceKind
|
||||||
}.firstOrNull()
|
}.firstOrNull()
|
||||||
|
|
||||||
fun ModuleDescriptor.hasDeclarationOf(descriptor: MemberDescriptor) = declarationOf(descriptor) != null
|
fun ModuleDescriptor.hasDeclarationOf(descriptor: MemberDescriptor) = declarationOf(descriptor) != null
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor
|
|||||||
import org.jetbrains.kotlin.idea.core.toDescriptor
|
import org.jetbrains.kotlin.idea.core.toDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
|
||||||
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
import java.awt.event.MouseEvent
|
import java.awt.event.MouseEvent
|
||||||
|
|
||||||
fun ModuleDescriptor.hasImplementationsOf(descriptor: MemberDescriptor) =
|
fun ModuleDescriptor.hasImplementationsOf(descriptor: MemberDescriptor) =
|
||||||
@@ -49,7 +51,7 @@ fun getPlatformImplementationTooltip(declaration: KtDeclaration): String? {
|
|||||||
if (platformModulesWithImplementation.isEmpty()) return null
|
if (platformModulesWithImplementation.isEmpty()) return null
|
||||||
|
|
||||||
return platformModulesWithImplementation.joinToString(prefix = "Has implementations in ") {
|
return platformModulesWithImplementation.joinToString(prefix = "Has implementations in ") {
|
||||||
it.platformKind.name
|
(it.getMultiTargetPlatform() as MultiTargetPlatform.Specific).platform
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-13
@@ -41,10 +41,12 @@ import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
|||||||
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
|
|
||||||
sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
||||||
declaration: D,
|
declaration: D,
|
||||||
private val implPlatformKind: PlatformKind,
|
private val implPlatform: MultiTargetPlatform.Specific,
|
||||||
private val generateIt: KtPsiFactory.(Project, D) -> D?
|
private val generateIt: KtPsiFactory.(Project, D) -> D?
|
||||||
) : KotlinQuickFixAction<D>(declaration) {
|
) : KotlinQuickFixAction<D>(declaration) {
|
||||||
|
|
||||||
@@ -52,7 +54,7 @@ sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
|||||||
|
|
||||||
protected abstract val elementType: String
|
protected abstract val elementType: String
|
||||||
|
|
||||||
override fun getText() = "Create header $elementType implementation for platform ${implPlatformKind.name}"
|
override fun getText() = "Create header $elementType implementation for platform ${implPlatform.platform}"
|
||||||
|
|
||||||
override fun startInWriteAction() = false
|
override fun startInWriteAction() = false
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@ sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
|||||||
|
|
||||||
private fun Project.implementationModuleOf(headerModule: Module) =
|
private fun Project.implementationModuleOf(headerModule: Module) =
|
||||||
allModules().firstOrNull {
|
allModules().firstOrNull {
|
||||||
TargetPlatformDetector.getPlatform(it).kind == implPlatformKind &&
|
TargetPlatformDetector.getPlatform(it).multiTargetPlatform == implPlatform &&
|
||||||
headerModule in ModuleRootManager.getInstance(it).dependencies
|
headerModule in ModuleRootManager.getInstance(it).dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,11 +138,11 @@ sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
|||||||
val declaration = d.psiElement as? KtNamedDeclaration ?: return null
|
val declaration = d.psiElement as? KtNamedDeclaration ?: return null
|
||||||
val compatibility = d.c
|
val compatibility = d.c
|
||||||
if (compatibility.isNotEmpty()) return null
|
if (compatibility.isNotEmpty()) return null
|
||||||
val implPlatformKind = d.b.platformKind
|
val implPlatform = d.b.getMultiTargetPlatform() as? MultiTargetPlatform.Specific ?: return null
|
||||||
return when (declaration) {
|
return when (declaration) {
|
||||||
is KtClassOrObject -> CreateHeaderClassImplementationFix(declaration, implPlatformKind)
|
is KtClassOrObject -> CreateHeaderClassImplementationFix(declaration, implPlatform)
|
||||||
is KtFunction -> CreateHeaderFunctionImplementationFix(declaration, implPlatformKind)
|
is KtFunction -> CreateHeaderFunctionImplementationFix(declaration, implPlatform)
|
||||||
is KtProperty -> CreateHeaderPropertyImplementationFix(declaration, implPlatformKind)
|
is KtProperty -> CreateHeaderPropertyImplementationFix(declaration, implPlatform)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,8 +151,8 @@ sealed class CreateHeaderImplementationFix<out D : KtNamedDeclaration>(
|
|||||||
|
|
||||||
class CreateHeaderClassImplementationFix(
|
class CreateHeaderClassImplementationFix(
|
||||||
klass: KtClassOrObject,
|
klass: KtClassOrObject,
|
||||||
implPlatformKind: PlatformKind
|
implPlatform: MultiTargetPlatform.Specific
|
||||||
) : CreateHeaderImplementationFix<KtClassOrObject>(klass, implPlatformKind, { project, element ->
|
) : CreateHeaderImplementationFix<KtClassOrObject>(klass, implPlatform, { project, element ->
|
||||||
generateClassOrObject(project, element, implNeeded = true)
|
generateClassOrObject(project, element, implNeeded = true)
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
@@ -159,8 +161,8 @@ class CreateHeaderClassImplementationFix(
|
|||||||
|
|
||||||
class CreateHeaderPropertyImplementationFix(
|
class CreateHeaderPropertyImplementationFix(
|
||||||
property: KtProperty,
|
property: KtProperty,
|
||||||
implPlatformKind: PlatformKind
|
implPlatform: MultiTargetPlatform.Specific
|
||||||
) : CreateHeaderImplementationFix<KtProperty>(property, implPlatformKind, { project, element ->
|
) : CreateHeaderImplementationFix<KtProperty>(property, implPlatform, { project, element ->
|
||||||
val descriptor = element.toDescriptor() as? PropertyDescriptor
|
val descriptor = element.toDescriptor() as? PropertyDescriptor
|
||||||
descriptor?.let { generateProperty(project, element, descriptor, implNeeded = true) }
|
descriptor?.let { generateProperty(project, element, descriptor, implNeeded = true) }
|
||||||
}) {
|
}) {
|
||||||
@@ -170,8 +172,8 @@ class CreateHeaderPropertyImplementationFix(
|
|||||||
|
|
||||||
class CreateHeaderFunctionImplementationFix(
|
class CreateHeaderFunctionImplementationFix(
|
||||||
function: KtFunction,
|
function: KtFunction,
|
||||||
implPlatformKind: PlatformKind
|
implPlatform: MultiTargetPlatform.Specific
|
||||||
) : CreateHeaderImplementationFix<KtFunction>(function, implPlatformKind, { project, element ->
|
) : CreateHeaderImplementationFix<KtFunction>(function, implPlatform, { project, element ->
|
||||||
val descriptor = element.toDescriptor() as? FunctionDescriptor
|
val descriptor = element.toDescriptor() as? FunctionDescriptor
|
||||||
descriptor?.let { generateFunction(project, element, descriptor, implNeeded = true) }
|
descriptor?.let { generateFunction(project, element, descriptor, implNeeded = true) }
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProvid
|
|||||||
object TopDownAnalyzerFacadeForJS {
|
object TopDownAnalyzerFacadeForJS {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun analyzeFiles(files: Collection<KtFile>, config: JsConfig): JsAnalysisResult {
|
fun analyzeFiles(files: Collection<KtFile>, config: JsConfig): JsAnalysisResult {
|
||||||
val context = ContextForNewModule(ProjectContext(config.project), Name.special("<${config.moduleId}>"), JsPlatform.builtIns)
|
val context = ContextForNewModule(
|
||||||
|
ProjectContext(config.project), Name.special("<${config.moduleId}>"), JsPlatform.builtIns, null
|
||||||
|
)
|
||||||
context.setDependencies(
|
context.setDependencies(
|
||||||
listOf(context.module) +
|
listOf(context.module) +
|
||||||
config.moduleDescriptors.map { it.data } +
|
config.moduleDescriptors.map { it.data } +
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ package org.jetbrains.kotlin.js.resolve
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.PlatformKind
|
|
||||||
import org.jetbrains.kotlin.resolve.ImportPath
|
import org.jetbrains.kotlin.resolve.ImportPath
|
||||||
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
|
|
||||||
@@ -31,7 +31,5 @@ object JsPlatform : TargetPlatform("JS") {
|
|||||||
val builtIns: KotlinBuiltIns
|
val builtIns: KotlinBuiltIns
|
||||||
get() = DefaultBuiltIns.Instance
|
get() = DefaultBuiltIns.Instance
|
||||||
|
|
||||||
override val kind: PlatformKind
|
override val multiTargetPlatform = MultiTargetPlatform.Specific(platformName)
|
||||||
get() = PlatformKind.JS
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user