Explicitly state that PluginDeclarationProviderFactory is source-only
Before this change `filesScope` was effectively empty in cases when
module info is a library, thus looking
into PackageIndexUtil.packageExists(name, indexedFilesScope, project)
was kind of redundant since it always returns false for empty scopes
The initial motivation was run by 1716720604
that made PackageIndexUtil::packageExists calls much more frequent
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.jvm
|
||||
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.*
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.container.get
|
||||
@@ -58,7 +57,7 @@ object JvmAnalyzerFacade : AnalyzerFacade() {
|
||||
val project = moduleContext.project
|
||||
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
|
||||
project, moduleContext.storageManager, syntheticFiles,
|
||||
if (moduleInfo.isLibrary) GlobalSearchScope.EMPTY_SCOPE else moduleContentScope,
|
||||
moduleContentScope,
|
||||
moduleInfo
|
||||
)
|
||||
|
||||
|
||||
@@ -233,8 +233,6 @@ data class ModuleContent(
|
||||
interface PlatformAnalysisParameters
|
||||
|
||||
interface ModuleInfo {
|
||||
val isLibrary: Boolean
|
||||
get() = false
|
||||
val name: Name
|
||||
val displayedName: String get() = name.asString()
|
||||
fun dependencies(): List<ModuleInfo>
|
||||
|
||||
@@ -112,7 +112,7 @@ object CommonAnalyzerFacade : AnalyzerFacade() {
|
||||
val project = moduleContext.project
|
||||
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
|
||||
project, moduleContext.storageManager, syntheticFiles,
|
||||
if (moduleInfo.isLibrary) GlobalSearchScope.EMPTY_SCOPE else moduleContentScope,
|
||||
moduleContentScope,
|
||||
moduleInfo
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -42,11 +42,11 @@ abstract class DeclarationProviderFactoryService {
|
||||
project: Project,
|
||||
storageManager: StorageManager,
|
||||
syntheticFiles: Collection<KtFile>,
|
||||
filesScope: GlobalSearchScope,
|
||||
moduleContentScope: GlobalSearchScope,
|
||||
moduleInfo: ModuleInfo
|
||||
): DeclarationProviderFactory {
|
||||
return ServiceManager.getService(project, DeclarationProviderFactoryService::class.java)!!
|
||||
.create(project, storageManager, syntheticFiles, filteringScope(syntheticFiles, filesScope), moduleInfo)
|
||||
.create(project, storageManager, syntheticFiles, filteringScope(syntheticFiles, moduleContentScope), moduleInfo)
|
||||
}
|
||||
|
||||
private fun filteringScope(syntheticFiles: Collection<KtFile>, baseScope: GlobalSearchScope): GlobalSearchScope {
|
||||
|
||||
Reference in New Issue
Block a user