extract error_unexpected_after_dot and de-fatalize

This commit is contained in:
Mazdak Farrokhzad 2019-12-07 00:59:56 +01:00
parent ff5762b78a
commit 9c6bbf1252
7 changed files with 40 additions and 27 deletions

View file

@ -715,11 +715,7 @@ impl<'a> Parser<'a> {
err?
}
}
_ => {
// FIXME Could factor this out into non_fatal_unexpected or something.
let actual = self.this_token_to_string();
self.span_err(self.token.span, &format!("unexpected token: `{}`", actual));
}
_ => self.error_unexpected_after_dot(),
}
continue;
}
@ -735,6 +731,12 @@ impl<'a> Parser<'a> {
return Ok(e);
}
fn error_unexpected_after_dot(&self) {
// FIXME Could factor this out into non_fatal_unexpected or something.
let actual = self.this_token_to_string();
self.struct_span_err(self.token.span, &format!("unexpected token: `{}`", actual)).emit();
}
fn recover_field_access_by_float_lit(
&mut self,
lo: Span,