From 367e523442520a1ff9050210ee2573ac1abe4b25 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Aug 2018 16:04:47 +0300 Subject: Require semi after exprs --- crates/libsyntax2/src/grammar/expressions/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/libsyntax2/src') 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) { // fn foo() { pub 92; } //FIXME items::MaybeItem::None => { let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block; - if p.eat(SEMI) || (is_blocklike && !p.at(R_CURLY)) { - m.complete(p, EXPR_STMT); - } else { + if p.at(R_CURLY) { m.abandon(p); + } else { + if is_blocklike { + p.eat(SEMI); + } else { + p.expect(SEMI); + } + m.complete(p, EXPR_STMT); } } } -- cgit v1.2.3