Add extraction of 'else' branch of 'when' expression

This commit is contained in:
Alexey Sedunov
2013-04-26 13:36:14 +04:00
parent f5b1706b30
commit b7bc251311
@@ -693,6 +693,15 @@ public class JetPsiUtil {
return (elseCount == 1);
}
public static JetExpression getWhenElseBranch(@NotNull JetWhenExpression whenExpression) {
for (JetWhenEntry entry : whenExpression.getEntries()) {
if (entry.isElse()) {
return entry.getExpression();
}
}
return null;
}
public static PsiElement skipTrailingWhitespacesAndComments(PsiElement element) {
return PsiTreeUtil.skipSiblingsForward(element, PsiWhiteSpace.class, PsiComment.class);
}