Add parens, as needed, around else-if conditions.

This commit is contained in:
Jesse Ruderman 2011-09-15 21:24:24 -07:00
parent 2c6eba00dd
commit ce1877dc8e
2 changed files with 10 additions and 3 deletions

View File

@ -625,7 +625,7 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
cbox(s, indent_unit - 1u);
ibox(s, 0u);
word(s.s, " else if ");
print_expr(s, i);
print_maybe_parens_discrim(s, i);
space(s.s);
print_block(s, t);
do_else(s, e);

View File

@ -21,8 +21,15 @@ fn what() {
}
fn zombiejesus() {
do { while (ret) { if (ret) { alt (ret) { _ { ret ? ret : ret } } } } }
while ret
do {
while (ret) {
if (ret) {
alt (ret) { _ { ret ? ret : ret } };
} else if (ret) {
ret;
}
}
} while ret
}
fn notsure() {