[Analysis API] Make a separate module for kt-reference-fe10
This commit is contained in:
committed by
Ilya Kirillov
parent
19e9143bc1
commit
010431e9e7
@@ -10,12 +10,12 @@ dependencies {
|
||||
implementation(project(":analysis:analysis-api-impl-base"))
|
||||
implementation(project(":analysis:analysis-internal-utils"))
|
||||
implementation(project(":analysis:kt-references"))
|
||||
implementation(project(":analysis:kt-references:kt-references-fe10"))
|
||||
|
||||
implementation(project(":compiler:backend"))
|
||||
implementation(project(":compiler:backend.jvm"))
|
||||
implementation(project(":compiler:backend-common"))
|
||||
implementation(project(":compiler:backend.common.jvm"))
|
||||
implementation(project(":compiler:light-classes"))
|
||||
|
||||
testApiJUnit5()
|
||||
testImplementation(project(":analysis:analysis-api-providers"))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":analysis:kt-references"))
|
||||
|
||||
implementation(project(":compiler:psi"))
|
||||
implementation(project(":compiler:light-classes"))
|
||||
implementation(intellijCore())
|
||||
|
||||
compileOnly(commonDependency("com.google.guava:guava"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { none() }
|
||||
}
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.references
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.references.KtArrayAccessReference
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10ReferenceResolutionHelper
|
||||
import org.jetbrains.kotlin.analysis.api.tokens.HackToForceAllowRunningAnalyzeOnEDT
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.references.KtDestructuringDeclarationReference
|
||||
@@ -36,7 +35,6 @@ class KtFe10DestructuringDeclarationEntry(
|
||||
return super<KtFe10Reference>.isReferenceToImportAlias(alias)
|
||||
}
|
||||
|
||||
@OptIn(HackToForceAllowRunningAnalyzeOnEDT::class)
|
||||
override fun canRename(): Boolean {
|
||||
val bindingContext = KtFe10ReferenceResolutionHelper.getInstance().partialAnalyze(element) //TODO: should it use full body resolve?
|
||||
return resolveToDescriptors(bindingContext).all {
|
||||
+1
-1
@@ -10,7 +10,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementResolveResult
|
||||
import com.intellij.psi.ResolveResult
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.utils.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.references.util.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.idea.references.AbstractKtReference
|
||||
+9
-13
@@ -7,11 +7,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references.base
|
||||
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.KtSymbolBasedReference
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.references.KtReference
|
||||
import org.jetbrains.kotlin.idea.references.unwrappedTargets
|
||||
@@ -20,7 +15,7 @@ import org.jetbrains.kotlin.psi.KtImportAlias
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
|
||||
interface KtFe10Reference : KtReference, KtSymbolBasedReference {
|
||||
interface KtFe10Reference : KtReference {
|
||||
override val resolver: ResolveCache.PolyVariantResolver<KtReference>
|
||||
get() = KtFe10PolyVariantResolver
|
||||
|
||||
@@ -51,11 +46,12 @@ interface KtFe10Reference : KtReference, KtSymbolBasedReference {
|
||||
}
|
||||
}
|
||||
|
||||
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
|
||||
require(this is KtFe10AnalysisSession)
|
||||
val bindingContext = KtFe10ReferenceResolutionHelper.getInstance().partialAnalyze(element)
|
||||
return getTargetDescriptors(bindingContext).mapNotNull { descriptor ->
|
||||
descriptor.toKtSymbol(analysisContext)
|
||||
}
|
||||
}
|
||||
// TODO: Implement KtSymbolBasedReference and uncomment the following implementation after FE10 analysis API is made available in IDE
|
||||
// override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
|
||||
// require(this is KtFe10AnalysisSession)
|
||||
// val bindingContext = KtFe10ReferenceResolutionHelper.getInstance().partialAnalyze(element)
|
||||
// return getTargetDescriptors(bindingContext).mapNotNull { descriptor ->
|
||||
// descriptor.toKtSymbol(analysisContext)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.utils
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.references.util
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -307,6 +307,7 @@ extra["compilerArtifactsForIde"] = listOfNotNull(
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fir-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fe10-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fe10-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kt-references-fe10-for-ide",
|
||||
":prepare:ide-plugin-dependencies:analysis-api-providers-for-ide",
|
||||
":prepare:ide-plugin-dependencies:analysis-project-structure-for-ide",
|
||||
":prepare:ide-plugin-dependencies:symbol-light-classes-for-ide",
|
||||
|
||||
@@ -11,6 +11,6 @@ val excludedCompilerModules = listOf(
|
||||
":compiler:incremental-compilation-impl"
|
||||
)
|
||||
|
||||
val projects = fe10CompilerModules.asList() - excludedCompilerModules
|
||||
val projects = fe10CompilerModules.asList() - excludedCompilerModules + listOf(":analysis:kt-references:kt-references-fe10")
|
||||
|
||||
publishJarsForIde(projects)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":analysis:kt-references:kt-references-fe10"))
|
||||
@@ -374,6 +374,7 @@ if (!buildProperties.inJpsBuildIdeaSync) {
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fir-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fe10-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fe10-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kt-references-fe10-for-ide",
|
||||
":prepare:ide-plugin-dependencies:analysis-api-providers-for-ide",
|
||||
":prepare:ide-plugin-dependencies:analysis-project-structure-for-ide",
|
||||
":prepare:ide-plugin-dependencies:symbol-light-classes-for-ide",
|
||||
@@ -547,6 +548,7 @@ include ":generators:analysis-api-generator",
|
||||
":analysis:analysis-internal-utils",
|
||||
":analysis:analysis-test-framework",
|
||||
":analysis:kt-references",
|
||||
":analysis:kt-references:kt-references-fe10",
|
||||
":analysis:symbol-light-classes",
|
||||
":analysis:project-structure",
|
||||
":analysis:analysis-api-standalone",
|
||||
|
||||
Reference in New Issue
Block a user