mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[uast] Remove all usages of wrapULiteral
This method is useless after enabling `kotlin.uast.force.uinjectionhost`. #KTIJ-27448 GitOrigin-RevId: 1f2f31224cea166b4c369c78a20883a9884ee0a5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7a58d3956d
commit
16728e87b0
@@ -544,8 +544,7 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im
|
||||
|
||||
private static boolean isSwitchCase(@NotNull UInjectionHost expression) {
|
||||
if (expression.getUastParent() instanceof USwitchClauseExpression parent) {
|
||||
return ContainerUtil.exists(parent.getCaseValues(),
|
||||
value -> expression.equals(UastLiteralUtils.wrapULiteral(value)));
|
||||
return ContainerUtil.exists(parent.getCaseValues(), value -> expression.equals(value));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -225,12 +225,12 @@ open class KotlinUastElementFactory(project: Project) : UastElementFactory {
|
||||
).getPossiblyQualifiedCallExpression() ?: return null
|
||||
|
||||
if (receiver != null) {
|
||||
methodCall.parentAs<KtDotQualifiedExpression>()?.receiverExpression?.replace(wrapULiteral(receiver).sourcePsi!!)
|
||||
methodCall.parentAs<KtDotQualifiedExpression>()?.receiverExpression?.replace(receiver.sourcePsi!!)
|
||||
}
|
||||
|
||||
val valueArgumentList = methodCall.valueArgumentList
|
||||
for (parameter in parameters) {
|
||||
valueArgumentList?.addArgument(psiFactory.createArgument(wrapULiteral(parameter).sourcePsi as KtExpression))
|
||||
valueArgumentList?.addArgument(psiFactory.createArgument(parameter.sourcePsi as KtExpression))
|
||||
}
|
||||
|
||||
if (context !is KtElement) return KotlinUFunctionCallExpression(methodCall, null)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
package org.jetbrains.uast.test.common.kotlin
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.platform.uast.testFramework.env.findElementByText
|
||||
import com.intellij.platform.uast.testFramework.env.findElementByTextFromPsi
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import junit.framework.TestCase
|
||||
@@ -18,8 +20,6 @@ import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.expressions.UInjectionHost
|
||||
import org.jetbrains.uast.kotlin.BaseKotlinUastResolveProviderService
|
||||
import org.jetbrains.uast.kotlin.KotlinUFunctionCallExpression
|
||||
import com.intellij.platform.uast.testFramework.env.findElementByText
|
||||
import com.intellij.platform.uast.testFramework.env.findElementByTextFromPsi
|
||||
import org.jetbrains.uast.visitor.AbstractUastVisitor
|
||||
import org.junit.Assert
|
||||
import kotlin.test.fail as kfail
|
||||
@@ -312,7 +312,7 @@ interface UastApiTestBase : UastPluginSelection {
|
||||
attributeValue.cast<PsiArrayInitializerMemberValue>().initializers[0]
|
||||
)
|
||||
assertEqualUast(
|
||||
wrapULiteral(uastAnnotationParamValue.cast<UCallExpression>().valueArguments[0]),
|
||||
uastAnnotationParamValue.cast<UCallExpression>().valueArguments[0],
|
||||
attributeValue.cast<PsiArrayInitializerMemberValue>().initializers[0]
|
||||
) { it.toUElementOfType<UInjectionHost>() }
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ open class UElementPattern<T : UElement, Self : UElementPattern<T, Self>>(clazz:
|
||||
|
||||
fun withStringRoomExpression(parentPattern: ElementPattern<out UElement>): Self = filterWithContext { it, context ->
|
||||
if (it !is UExpression) return@filterWithContext false
|
||||
val uHost = wrapULiteral(it) as? UInjectionHost ?: return@filterWithContext false
|
||||
val uHost = it as? UInjectionHost ?: return@filterWithContext false
|
||||
val room = uHost.getStringRoomExpression()
|
||||
|
||||
parentPattern.accepts(room, context)
|
||||
@@ -111,7 +111,7 @@ private fun isCallExpressionParameter(argumentExpression: UExpression,
|
||||
|
||||
return callPattern.accepts(call, context)
|
||||
&& call.kind in constructorOrMethodCall
|
||||
&& call.getArgumentForParameter(parameterIndex)?.let(::wrapULiteral) == wrapULiteral(argumentExpression)
|
||||
&& call.getArgumentForParameter(parameterIndex) == argumentExpression
|
||||
}
|
||||
|
||||
private fun isPropertyAssignCall(argument: UElement, methodPattern: ElementPattern<out PsiMethod>, context: ProcessingContext): Boolean {
|
||||
|
||||
@@ -100,8 +100,8 @@ interface UastLanguagePlugin {
|
||||
fun tryConvertToEntry(uElement: UElement, parent: UElement, name: String?): Pair<UAnnotation, String?>? {
|
||||
if (uElement !is UExpression) return null
|
||||
val uAnnotation = parent.sourcePsi.toUElementOfType<UAnnotation>() ?: return null
|
||||
val argumentSourcePsi = wrapULiteral(uElement).sourcePsi
|
||||
return uAnnotation to (name ?: uAnnotation.attributeValues.find { wrapULiteral(it.expression).sourcePsi === argumentSourcePsi }?.name)
|
||||
val argumentSourcePsi = uElement.sourcePsi
|
||||
return uAnnotation to (name ?: uAnnotation.attributeValues.find { it.expression.sourcePsi === argumentSourcePsi }?.name)
|
||||
}
|
||||
|
||||
tailrec fun retrievePsiAnnotationEntry(uElement: UElement?, name: String?): Pair<UAnnotation, String?>? {
|
||||
|
||||
@@ -226,7 +226,7 @@ fun UCallExpression.getParameterForArgument(arg: UExpression): PsiParameter? {
|
||||
|
||||
return parameters.withIndex().find { (i, p) ->
|
||||
val argumentForParameter = getArgumentForParameter(i) ?: return@find false
|
||||
if (wrapULiteral(argumentForParameter) == wrapULiteral(arg)) return@find true
|
||||
if (argumentForParameter == arg) return@find true
|
||||
if (p.isVarArgs && argumentForParameter is UExpressionList) return@find argumentForParameter.expressions.contains(arg)
|
||||
return@find false
|
||||
}?.value
|
||||
|
||||
Reference in New Issue
Block a user