syntax: Pretty-print 'do' correctly

This commit is contained in:
Brian Anderson 2012-06-29 15:37:17 -07:00
parent ba6f71f1b8
commit 8b2491160d
2 changed files with 8 additions and 0 deletions

View File

@ -879,6 +879,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
let blk_arg = vec::pop(base_args); let blk_arg = vec::pop(base_args);
alt blk_arg.node { alt blk_arg.node {
ast::expr_loop_body(_) { word_nbsp(s, "for"); } ast::expr_loop_body(_) { word_nbsp(s, "for"); }
ast::expr_do_body(_) { word_nbsp(s, "do"); }
_ {} _ {}
} }
some(blk_arg) some(blk_arg)

7
src/test/pretty/do1.rs Normal file
View File

@ -0,0 +1,7 @@
// pretty-exact
fn f(f: fn@(int)) { f(10) }
fn main() {
do f { |i| assert i == 10 }
}