parse: move condition into guard
This commit is contained in:
parent
32295aee6e
commit
1eb0844f5d
1 changed files with 27 additions and 27 deletions
|
@ -366,9 +366,10 @@ impl<'a> Parser<'a> {
|
|||
|
||||
let mut eat_semi = true;
|
||||
match stmt.kind {
|
||||
StmtKind::Expr(ref expr) if self.token != token::Eof => {
|
||||
// expression without semicolon
|
||||
if classify::expr_requires_semi_to_be_stmt(expr) {
|
||||
// Expression without semicolon.
|
||||
StmtKind::Expr(ref expr)
|
||||
if self.token != token::Eof && classify::expr_requires_semi_to_be_stmt(expr) =>
|
||||
{
|
||||
// Just check for errors and recover; do not eat semicolon yet.
|
||||
if let Err(mut e) =
|
||||
self.expect_one_of(&[], &[token::Semi, token::CloseDelim(token::Brace)])
|
||||
|
@ -397,7 +398,6 @@ impl<'a> Parser<'a> {
|
|||
stmt.kind = StmtKind::Expr(self.mk_expr_err(sp));
|
||||
}
|
||||
}
|
||||
}
|
||||
StmtKind::Local(..) => {
|
||||
self.expect_semi()?;
|
||||
eat_semi = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue