Reformat ReplaceCallWithBinaryOperator
This commit is contained in:
+3
-4
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.types.typeUtil.*
|
|||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
|
|
||||||
class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspection<KtDotQualifiedExpression>(
|
class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspection<KtDotQualifiedExpression>(
|
||||||
KtDotQualifiedExpression::class.java
|
KtDotQualifiedExpression::class.java
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private fun IElementType.inverted(): KtSingleValueToken? = when (this) {
|
private fun IElementType.inverted(): KtSingleValueToken? = when (this) {
|
||||||
@@ -127,7 +127,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun PsiElement.getWrappingPrefixExpressionIfAny() =
|
private fun PsiElement.getWrappingPrefixExpressionIfAny() =
|
||||||
(getLastParentOfTypeInRow<KtParenthesizedExpression>() ?: this).parent as? KtPrefixExpression
|
(getLastParentOfTypeInRow<KtParenthesizedExpression>() ?: this).parent as? KtPrefixExpression
|
||||||
|
|
||||||
private fun operation(calleeExpression: KtSimpleNameExpression): KtSingleValueToken? {
|
private fun operation(calleeExpression: KtSimpleNameExpression): KtSingleValueToken? {
|
||||||
val identifier = calleeExpression.getReferencedNameAsName()
|
val identifier = calleeExpression.getReferencedNameAsName()
|
||||||
@@ -151,8 +151,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
|
|||||||
val token = binaryParent.operationToken as? KtSingleValueToken ?: return null
|
val token = binaryParent.operationToken as? KtSingleValueToken ?: return null
|
||||||
if (token in OperatorConventions.COMPARISON_OPERATIONS) {
|
if (token in OperatorConventions.COMPARISON_OPERATIONS) {
|
||||||
if (notZero == binaryParent.left) token else token.inverted()
|
if (notZero == binaryParent.left) token else token.inverted()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user