Fix #1458 (allow paren'd exprs to be the operator in a `do`)

Closes #1458
This commit is contained in:
Tim Chevalier 2012-10-30 15:00:57 -07:00
parent 165ce14f68
commit 4e5865f2ad
2 changed files with 13 additions and 1 deletions

View File

@ -1576,7 +1576,7 @@ impl Parser {
@{node: expr_call(f, args, true),
.. *e}
}
expr_path(*) | expr_field(*) | expr_call(*) => {
expr_path(*) | expr_field(*) | expr_call(*) | expr_paren(*) => {
let block = self.parse_lambda_block_expr();
let last_arg = self.mk_expr(block.span.lo, block.span.hi,
ctor(block));

View File

@ -0,0 +1,12 @@
fn plus_one(f: fn() -> int) -> int {
return f() + 1;
}
fn ret_plus_one() -> fn(fn() -> int) -> int {
return plus_one;
}
fn main() {
let z = do (ret_plus_one()) || { 2 };
assert z == 3;
}