simplifying of polyadic expressions:IDEA-76076

This commit is contained in:
anna
2011-10-28 11:44:55 +02:00
parent 514850e10f
commit 7b0692acbc
3 changed files with 18 additions and 1 deletions

View File

@@ -253,7 +253,12 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
simplifyBinary(tokenType, r, lExpr);
}
else {
resultExpression = null;
final PsiJavaToken javaToken = expression.getTokenBeforeOperand(operand);
if (javaToken != null) {
resultExpression = JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText(lExpr.getText() + javaToken.getText() + operand.getText(), expression);
} else {
resultExpression = null;
}
}
if (resultExpression != null) {
lExpr = resultExpression;

View File

@@ -0,0 +1,6 @@
// "Simplify boolean expression" "true"
class X {
void f(boolean b, boolean c) {
if (b && c) return;
}
}

View File

@@ -0,0 +1,6 @@
// "Simplify boolean expression" "true"
class X {
void f(boolean b, boolean c) {
if (b && tr<caret>ue && c) return;
}
}