ASTNode (int role) { LOG.assertTrue(ChildRole.isUnique(role)); switch(role){ default: return null; case ChildRole.IF_KEYWORD: return findChildByType(IF_KEYWORD); case ChildRole.LPARENTH: return findChildByType(LPARENTH); case ChildRole.CONDITION: return findChildByType(EXPRESSION_BIT_SET); case ChildRole.RPARENTH: return findChildByType(RPARENTH); case ChildRole.THEN_BRANCH: return PsiImplUtil.findStatementChild(this); case ChildRole.ELSE_KEYWORD: return findChildByType(ELSE_KEYWORD); case ChildRole.ELSE_BRANCH: ASTNode elseKeyword = findChildByRole(ChildRole.ELSE_KEYWORD); if (elseKeyword == null) return null; for(ASTNode child = elseKeyword.getTreeNext(); child != null; child = child.getTreeNext()){ if (child.getPsi() instanceof PsiStatement) return child; } return null; } }