Extract method for else branch check in when expression

This commit is contained in:
Alexey Sedunov
2013-04-12 18:42:35 +04:00
parent edea00f53e
commit 033e82666d
4 changed files with 19 additions and 26 deletions
@@ -682,4 +682,14 @@ public class JetPsiUtil {
return false;
}
public static boolean checkWhenExpressionHasSingleElse(JetWhenExpression whenExpression) {
int elseCount = 0;
for (JetWhenEntry entry : whenExpression.getEntries()) {
if (entry.isElse()) {
elseCount++;
}
}
return (elseCount == 1);
}
}