Simplifies a switch expression with identical branches. @return new or original expression
()
| 153 | * @return new or original expression |
| 154 | */ |
| 155 | private Expr simplify() { |
| 156 | // only the default branch may be left at this stage |
| 157 | final Expr expr = groups[0].rtrn(); |
| 158 | for(int g = groups.length - 1; g >= 1; g--) { |
| 159 | if(!expr.equals(groups[g].rtrn())) return this; |
| 160 | } |
| 161 | return expr; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Rewrites the switch to an if expression. |