diff options
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index fb9eca8640d..b2aa0e7b4dc 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -948,15 +948,13 @@ fn parse_bottom_expr(&parser p) -> @ast::expr { hi = e.span.hi; ex = ast::expr_check(ast::unchecked, e); } else if (eat_word(p, "ret")) { - alt (p.peek()) { - case (token::SEMI) { ex = ast::expr_ret(none); } - // Handle ret as the block result expression - case (token::RBRACE) { ex = ast::expr_ret(none); } - case (_) { - auto e = parse_expr(p); - hi = e.span.hi; - ex = ast::expr_ret(some(e)); - } + if (can_begin_expr(p.peek())) { + auto e = parse_expr(p); + hi = e.span.hi; + ex = ast::expr_ret(some(e)); + } + else { + ex = ast::expr_ret(none); } } else if (eat_word(p, "break")) { ex = ast::expr_break; |
