Represent unique creation as a unop in the AST instead of its own expr

Like the box unop.

Issue #409
This commit is contained in:
Brian Anderson 2011-09-20 18:06:47 -07:00
parent 7ae251789c
commit f809e22697
10 changed files with 21 additions and 20 deletions

View file

@ -886,9 +886,6 @@ fn parse_bottom_expr(p: parser) -> @ast::expr {
} else if p.peek() == token::ELLIPSIS {
p.bump();
ret mk_mac_expr(p, lo, p.get_hi_pos(), ast::mac_ellipsis);
} else if p.peek() == token::TILDE {
p.bump();
ex = ast::expr_uniq(parse_expr(p));
} else if eat_word(p, "obj") {
// Anonymous object
@ -1145,6 +1142,13 @@ fn parse_prefix_expr(p: parser) -> @ast::expr {
hi = e.span.hi;
ex = ast::expr_unary(ast::box(m), e);
}
token::TILDE. {
p.bump();
let m = parse_mutability(p);
let e = parse_prefix_expr(p);
hi = e.span.hi;
ex = ast::expr_unary(ast::uniq(m), e);
}
_ { ret parse_dot_or_call_expr(p); }
}
ret mk_expr(p, lo, hi, ex);