Skip to content

Commit de383bc

Browse files
committed
extend parser so that expressions that do not require semi-colons
to be statements are not considered expressions in the tail position
1 parent 9e1dc70 commit de383bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/comp/syntax/parse/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1621,8 +1621,8 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
16211621

16221622
fn stmt_to_expr(stmt: @ast::stmt) -> option::t<@ast::expr> {
16231623
alt stmt.node {
1624-
ast::stmt_expr(e, _) { some(e) }
1625-
ast::stmt_decl(_, _) { none }
1624+
ast::stmt_expr(e, _) when expr_requires_semi_to_be_stmt(e) { some(e) }
1625+
_ { none }
16261626
}
16271627
}
16281628

0 commit comments

Comments
 (0)