mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[uast] Relax return type on createStringLiteralExpression
Changes the return type of `createStringLiteralExpression` to account for Kotlin having polyadic string literal implementation by default. #KTIJ-27448 GitOrigin-RevId: 0797f4ea1f935ca29725f3834c535c3e60f9db36
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ad36587b52
commit
d274c9c258
@@ -23,7 +23,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.uast.UBinaryExpression;
|
||||
import org.jetbrains.uast.ULiteralExpression;
|
||||
import org.jetbrains.uast.UExpression;
|
||||
import org.jetbrains.uast.UastBinaryOperator;
|
||||
import org.jetbrains.uast.UastUtils;
|
||||
import org.jetbrains.uast.expressions.UInjectionHost;
|
||||
@@ -153,8 +153,8 @@ public class I18nizeQuickFix extends AbstractI18nizeQuickFix<UInjectionHost> {
|
||||
int breakIndex = offset - literalRange.getStartOffset() - 1;
|
||||
String lsubstring = value.substring(0, breakIndex);
|
||||
String rsubstring = value.substring(breakIndex);
|
||||
ULiteralExpression left = elementFactory.createStringLiteralExpression(lsubstring, sourcePsi);
|
||||
ULiteralExpression right = elementFactory.createStringLiteralExpression(rsubstring, sourcePsi);
|
||||
UExpression left = elementFactory.createStringLiteralExpression(lsubstring, sourcePsi);
|
||||
UExpression right = elementFactory.createStringLiteralExpression(rsubstring, sourcePsi);
|
||||
if (left == null || right == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -276,8 +276,9 @@ open class KotlinUastElementFactory(project: Project) : UastElementFactory {
|
||||
return KotlinUCallableReferenceExpression(callableExpression, null)
|
||||
}
|
||||
|
||||
override fun createStringLiteralExpression(text: String, context: PsiElement?): ULiteralExpression {
|
||||
return KotlinStringULiteralExpression(psiFactory(context).createExpression(StringUtil.wrapWithDoubleQuote(text)), null)
|
||||
override fun createStringLiteralExpression(text: String, context: PsiElement?): UExpression {
|
||||
val literal = psiFactory(context).createExpression(StringUtil.wrapWithDoubleQuote(text)) as KtStringTemplateExpression
|
||||
return KotlinStringTemplateUPolyadicExpression(literal, null)
|
||||
}
|
||||
|
||||
override fun createLongConstantExpression(long: Long, context: PsiElement?): UExpression? {
|
||||
|
||||
@@ -183,7 +183,7 @@ interface UastElementFactory {
|
||||
|
||||
fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?, context: PsiElement?): UIfExpression?
|
||||
|
||||
fun createStringLiteralExpression(text: String, context: PsiElement?): ULiteralExpression?
|
||||
fun createStringLiteralExpression(text: String, context: PsiElement?): UExpression?
|
||||
|
||||
fun createLongConstantExpression(long: Long, context: PsiElement?): UExpression?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user