diff options
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/grammar/expressions/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs index 922d9f871..fb702a398 100644 --- a/crates/libsyntax2/src/grammar/expressions/mod.rs +++ b/crates/libsyntax2/src/grammar/expressions/mod.rs | |||
@@ -51,10 +51,15 @@ pub(crate) fn block(p: &mut Parser) { | |||
51 | // fn foo() { pub 92; } //FIXME | 51 | // fn foo() { pub 92; } //FIXME |
52 | items::MaybeItem::None => { | 52 | items::MaybeItem::None => { |
53 | let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block; | 53 | let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block; |
54 | if p.eat(SEMI) || (is_blocklike && !p.at(R_CURLY)) { | 54 | if p.at(R_CURLY) { |
55 | m.complete(p, EXPR_STMT); | ||
56 | } else { | ||
57 | m.abandon(p); | 55 | m.abandon(p); |
56 | } else { | ||
57 | if is_blocklike { | ||
58 | p.eat(SEMI); | ||
59 | } else { | ||
60 | p.expect(SEMI); | ||
61 | } | ||
62 | m.complete(p, EXPR_STMT); | ||
58 | } | 63 | } |
59 | } | 64 | } |
60 | } | 65 | } |