Get rid of Block::recovered

This commit is contained in:
Vadim Petrochenkov 2018-12-20 02:33:56 +03:00
parent fff01ccfa8
commit 4ac592516f
13 changed files with 12 additions and 41 deletions

View file

@ -32,6 +32,7 @@ use ast::{UseTree, UseTreeKind};
use ast::{BinOpKind, UnOp};
use ast::{RangeEnd, RangeSyntax};
use {ast, attr};
use ext::base::DummyResult;
use source_map::{self, SourceMap, Spanned, respan};
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName};
use errors::{self, Applicability, DiagnosticBuilder, DiagnosticId};
@ -4966,16 +4967,16 @@ impl<'a> Parser<'a> {
/// Precondition: already parsed the '{'.
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
let mut stmts = vec![];
let mut recovered = false;
while !self.eat(&token::CloseDelim(token::Brace)) {
let stmt = match self.parse_full_stmt(false) {
Err(mut err) => {
err.emit();
self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
self.eat(&token::CloseDelim(token::Brace));
recovered = true;
break;
Some(Stmt {
id: ast::DUMMY_NODE_ID,
node: StmtKind::Expr(DummyResult::raw_expr(self.span)),
span: self.span,
})
}
Ok(stmt) => stmt,
};
@ -4993,7 +4994,6 @@ impl<'a> Parser<'a> {
id: ast::DUMMY_NODE_ID,
rules: s,
span: lo.to(self.prev_span),
recovered,
}))
}