ReplaceInfixCallFix --> ReplaceInfixOrOperatorCallFix
(cherry picked from commit 679867b)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
995a633229
commit
d8bd90fb90
@@ -203,9 +203,9 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
|
||||
UNSAFE_CALL.registerFactory(AddExclExclCallFix)
|
||||
UNNECESSARY_NOT_NULL_ASSERTION.registerFactory(RemoveExclExclCallFix)
|
||||
UNSAFE_INFIX_CALL.registerFactory(ReplaceInfixCallFix)
|
||||
UNSAFE_CALL.registerFactory(ReplaceInfixCallFix) // [] only
|
||||
UNSAFE_IMPLICIT_INVOKE_CALL.registerFactory(ReplaceInfixCallFix)
|
||||
UNSAFE_INFIX_CALL.registerFactory(ReplaceInfixOrOperatorCallFix)
|
||||
UNSAFE_CALL.registerFactory(ReplaceInfixOrOperatorCallFix) // [] only
|
||||
UNSAFE_IMPLICIT_INVOKE_CALL.registerFactory(ReplaceInfixOrOperatorCallFix)
|
||||
|
||||
AMBIGUOUS_ANONYMOUS_TYPE_INFERRED.registerActions(SpecifyTypeExplicitlyFix())
|
||||
PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.registerActions(SpecifyTypeExplicitlyFix())
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getAssignmentByLHS
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||
|
||||
class ReplaceInfixCallFix(element: KtExpression) : KotlinQuickFixAction<KtExpression>(element) {
|
||||
class ReplaceInfixOrOperatorCallFix(element: KtExpression) : KotlinQuickFixAction<KtExpression>(element) {
|
||||
|
||||
override fun getText() = "Replace with safe (?.) call"
|
||||
|
||||
@@ -81,18 +81,18 @@ class ReplaceInfixCallFix(element: KtExpression) : KotlinQuickFixAction<KtExpres
|
||||
val expression = diagnostic.psiElement
|
||||
if (expression is KtArrayAccessExpression) {
|
||||
if (expression.arrayExpression == null) return null
|
||||
return ReplaceInfixCallFix(expression)
|
||||
return ReplaceInfixOrOperatorCallFix(expression)
|
||||
}
|
||||
val parent = expression.parent
|
||||
return when (parent) {
|
||||
is KtBinaryExpression -> {
|
||||
if (parent.left == null || parent.right == null) null
|
||||
else ReplaceInfixCallFix(parent)
|
||||
else ReplaceInfixOrOperatorCallFix(parent)
|
||||
}
|
||||
is KtCallExpression -> {
|
||||
if (parent.calleeExpression == null) null
|
||||
else if (parent.parent is KtQualifiedExpression) null
|
||||
else ReplaceInfixCallFix(parent)
|
||||
else ReplaceInfixOrOperatorCallFix(parent)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
Reference in New Issue
Block a user