CLion/AppCode: Provide proper TargetPlatform & TargetPlatformVersion to FE
This commit is contained in:
committed by
Dmitriy Dolovov
parent
49de7becfd
commit
4a99cb274b
@@ -309,6 +309,9 @@ data class LibrarySourceInfo(val project: Project, val library: Library, overrid
|
||||
return createLibraryInfo(project, library)
|
||||
}
|
||||
|
||||
override val platform: TargetPlatform?
|
||||
get() = binariesModuleInfo.platform
|
||||
|
||||
override fun toString() = "LibrarySourceInfo(libraryName=${library.name})"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService {
|
||||
// we assume that all files come from the same module
|
||||
val targetPlatform = files.map { TargetPlatformDetector.getPlatform(it) }.toSet().single()
|
||||
val specialModuleInfo = files.map(KtFile::getModuleInfo).toSet().single()
|
||||
val settings = specialModuleInfo.platformSettings(targetPlatform)
|
||||
val settings = specialModuleInfo.platformSettings(specialModuleInfo.platform ?: targetPlatform)
|
||||
|
||||
// File copies are created during completion and receive correct modification events through POM.
|
||||
// Dummy files created e.g. by J2K do not receive events.
|
||||
|
||||
+8
-2
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.container.ComponentProvider
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.context.GlobalContext
|
||||
@@ -31,6 +32,8 @@ import org.jetbrains.kotlin.context.withProject
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
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.compiler.IDELanguageSettingsProvider
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.idea.project.jvmTarget
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
@@ -182,8 +185,11 @@ private object KotlinResolveDataProvider {
|
||||
allowSliceRewrite = true
|
||||
)
|
||||
|
||||
val targetPlatform = TargetPlatformDetector.getPlatform(analyzableElement.containingKtFile)
|
||||
val moduleInfo = analyzableElement.containingKtFile.getModuleInfo()
|
||||
|
||||
val targetPlatform = moduleInfo.platform ?: TargetPlatformDetector.getPlatform(analyzableElement.containingKtFile)
|
||||
|
||||
val targetPlatformVersion = IDELanguageSettingsProvider.getTargetPlatform(moduleInfo, project)
|
||||
val lazyTopDownAnalyzer = createContainerForLazyBodyResolve(
|
||||
//TODO: should get ModuleContext
|
||||
globalContext.withProject(project).withModule(moduleDescriptor),
|
||||
@@ -191,7 +197,7 @@ private object KotlinResolveDataProvider {
|
||||
trace,
|
||||
targetPlatform,
|
||||
bodyResolveCache,
|
||||
analyzableElement.jvmTarget,
|
||||
targetPlatformVersion,
|
||||
analyzableElement.languageVersionSettings
|
||||
).get<LazyTopDownAnalyzer>()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user