Parenthesize unary move exprs in prettyprinter

Closes #3220
This commit is contained in:
Tim Chevalier 2012-08-23 16:58:43 -07:00
parent 5eea7d6e61
commit 80d129aa45
2 changed files with 13 additions and 1 deletions

View file

@ -1234,7 +1234,12 @@ fn print_field(s: ps, field: ast::field) {
print_block(s, blk);
}
ast::expr_copy(e) => { word_space(s, ~"copy"); print_expr(s, e); }
ast::expr_unary_move(e) => { word_space(s, ~"move"); print_expr(s, e); }
ast::expr_unary_move(e) => {
popen(s);
word_space(s, ~"move");
print_expr(s, e);
pclose(s);
}
ast::expr_move(lhs, rhs) => {
print_expr(s, lhs);
space(s.s);

View file

@ -0,0 +1,7 @@
struct thing { x: int; new () { self.x = 0; } drop { } }
impl thing { fn f(self) {} }
fn main() {
let z = thing();
(move z).f();
}