diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-09-15 10:12:09 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-09-15 10:14:52 +0200 |
| commit | 63ecc84562462830d08f1842fcf9b4fc3e35f754 (patch) | |
| tree | 88b06283809e76964d0b5245a479c70995377a3c /src/comp/syntax | |
| parent | 3798b6f780d2490037cf79cb2f8518795de376ba (diff) | |
| download | rust-63ecc84562462830d08f1842fcf9b4fc3e35f754.tar.gz rust-63ecc84562462830d08f1842fcf9b4fc3e35f754.zip | |
Also handle fail and put in print_maybe_parens_discrim
Closes #920
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 6d571d61d14..667f1255fde 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -594,8 +594,11 @@ fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type, // ret and fail, without arguments cannot appear is the discriminant of if, // alt, do, & while unambiguously without being parenthesized fn print_maybe_parens_discrim(s: ps, e: @ast::expr) { - let disambig = - alt e.node { ast::expr_ret(option::none.) { true } _ { false } }; + let disambig = alt e.node { + ast::expr_ret(none.) | ast::expr_put(none.) | + ast::expr_fail(none.) { true } + _ { false } + }; if disambig { popen(s) } print_expr(s, e); if disambig { pclose(s) } |
