Uast: eliminating the kotlin.uast.multiresolve.enabled, it is always true for a long time
This commit is contained in:
@@ -176,11 +176,6 @@
|
||||
defaultValue="true"
|
||||
restartRequired="false"/>
|
||||
|
||||
<registryKey key="kotlin.uast.multiresolve.enabled"
|
||||
description="Whether to use multi resolve for UAST in Kotlin provided by `Call.resolveCandidates`, otherwise PsiPolyVariantReference-based multiResolve will be performed"
|
||||
defaultValue="true"
|
||||
restartRequired="false"/>
|
||||
|
||||
<registryKey key="kotlin.uast.force.uinjectionhost"
|
||||
description="Whether to convert `KtStringTemplateExpression` to `KotlinStringTemplateUPolyadicExpression` in all cases"
|
||||
defaultValue="true"
|
||||
|
||||
-11
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
@@ -34,13 +33,11 @@ import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.internal.acceptList
|
||||
import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier
|
||||
import org.jetbrains.uast.kotlin.internal.TypedResolveResult
|
||||
import org.jetbrains.uast.kotlin.internal.getReferenceVariants
|
||||
import org.jetbrains.uast.kotlin.internal.multiResolveResults
|
||||
import org.jetbrains.uast.visitor.UastVisitor
|
||||
|
||||
class KotlinUFunctionCallExpression(
|
||||
@@ -173,14 +170,6 @@ class KotlinUFunctionCallExpression(
|
||||
|
||||
private val multiResolved by lazy(fun(): Iterable<TypedResolveResult<PsiMethod>> {
|
||||
val contextElement = sourcePsi
|
||||
|
||||
if (!Registry.`is`("kotlin.uast.multiresolve.enabled", true)) {
|
||||
val calleeExpression = contextElement.calleeExpression ?: return emptyList()
|
||||
return calleeExpression.multiResolveResults()
|
||||
.mapNotNull { it.element.safeAs<PsiMethod>()?.let { TypedResolveResult(it) } }
|
||||
.asIterable()
|
||||
}
|
||||
|
||||
val calleeExpression = contextElement.calleeExpression as? KtReferenceExpression ?: return emptyList()
|
||||
val methodName = methodName ?: calleeExpression.text ?: return emptyList()
|
||||
val variants = getReferenceVariants(calleeExpression, methodName)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.uast.kotlin.internal
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiPolyVariantReference
|
||||
import com.intellij.psi.PsiSubstitutor
|
||||
@@ -29,8 +28,6 @@ internal fun getReferenceVariants(ktElement: KtElement, nameHint: String): Seque
|
||||
internal fun UElement.getResolveResultVariants(ktExpression: KtExpression?): Iterable<ResolveResult> {
|
||||
ktExpression ?: return emptyList()
|
||||
|
||||
if (!Registry.`is`("kotlin.uast.multiresolve.enabled", true)) return ktExpression.multiResolveResults().asIterable()
|
||||
|
||||
val referenceVariants = getReferenceVariants(ktExpression, ktExpression.name ?: ktExpression.text)
|
||||
|
||||
fun asCandidateInfo(descriptor: DeclarationDescriptor): CandidateInfo? =
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
@@ -21,11 +20,6 @@ abstract class AbstractKotlinUastLightCodeInsightFixtureTest : KotlinLightCodeIn
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
Registry.get("kotlin.uast.multiresolve.enabled").setValue(true, testRootDisposable)
|
||||
}
|
||||
|
||||
fun getVirtualFile(testName: String): VirtualFile {
|
||||
val testFile = TEST_KOTLIN_MODEL_DIR.listFiles { pathname -> pathname.nameWithoutExtension == testName }.first()
|
||||
val vfs = VirtualFileManager.getInstance().getFileSystem(URLUtil.FILE_PROTOCOL)
|
||||
|
||||
@@ -21,11 +21,6 @@ abstract class AbstractKotlinUastLightCodeInsightFixtureTest : KotlinLightCodeIn
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
Registry.get("kotlin.uast.multiresolve.enabled").setValue(true, testRootDisposable)
|
||||
}
|
||||
|
||||
fun getVirtualFile(testName: String): VirtualFile {
|
||||
val testFile = TEST_KOTLIN_MODEL_DIR.listFiles { pathname -> pathname.nameWithoutExtension == testName }.first()
|
||||
val vfs = VirtualFileManager.getInstance().getFileSystem(URLUtil.FILE_PROTOCOL)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiClassType
|
||||
import com.intellij.psi.PsiType
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
@@ -29,10 +28,6 @@ class KotlinUastResolveApiTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
Registry.get("kotlin.uast.multiresolve.enabled").setValue(true, testRootDisposable)
|
||||
}
|
||||
|
||||
fun testResolveStringFromUast() {
|
||||
val file = myFixture.addFileToProject(
|
||||
|
||||
Reference in New Issue
Block a user