mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
extend parser so that expressions that do not require semi-colons
to be statements are not considered expressions in the tail position
This commit is contained in:
parent
9e1dc703d2
commit
de383bcfed
@ -1621,8 +1621,8 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
|
||||
|
||||
fn stmt_to_expr(stmt: @ast::stmt) -> option::t<@ast::expr> {
|
||||
alt stmt.node {
|
||||
ast::stmt_expr(e, _) { some(e) }
|
||||
ast::stmt_decl(_, _) { none }
|
||||
ast::stmt_expr(e, _) when expr_requires_semi_to_be_stmt(e) { some(e) }
|
||||
_ { none }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user