Reformat ReplaceCallWithBinaryOperator

This commit is contained in:
Mikhail Glukhikh
2018-10-09 14:47:36 +03:00
parent 1aa9d5673b
commit 04cadf3f58
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.types.typeUtil.*
import org.jetbrains.kotlin.util.OperatorNameConventions
class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspection<KtDotQualifiedExpression>(
KtDotQualifiedExpression::class.java
KtDotQualifiedExpression::class.java
) {
private fun IElementType.inverted(): KtSingleValueToken? = when (this) {
@@ -127,7 +127,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
}
private fun PsiElement.getWrappingPrefixExpressionIfAny() =
(getLastParentOfTypeInRow<KtParenthesizedExpression>() ?: this).parent as? KtPrefixExpression
(getLastParentOfTypeInRow<KtParenthesizedExpression>() ?: this).parent as? KtPrefixExpression
private fun operation(calleeExpression: KtSimpleNameExpression): KtSingleValueToken? {
val identifier = calleeExpression.getReferencedNameAsName()
@@ -151,8 +151,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
val token = binaryParent.operationToken as? KtSingleValueToken ?: return null
if (token in OperatorConventions.COMPARISON_OPERATIONS) {
if (notZero == binaryParent.left) token else token.inverted()
}
else {
} else {
null
}
}