mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
start item recovery
This commit is contained in:
parent
faebae74e4
commit
8fc7f438c4
7 changed files with 40 additions and 9 deletions
|
@ -12,7 +12,7 @@ fn mask(kind: SyntaxKind) -> u128 {
|
|||
}
|
||||
|
||||
impl TokenSet {
|
||||
const EMPTY: TokenSet = TokenSet(0);
|
||||
pub const EMPTY: TokenSet = TokenSet(0);
|
||||
|
||||
pub fn contains(&self, kind: SyntaxKind) -> bool {
|
||||
self.0 & mask(kind) != 0
|
||||
|
@ -145,10 +145,10 @@ impl<'t> Parser<'t> {
|
|||
}
|
||||
|
||||
/// Create an error node and consume the next token.
|
||||
pub(crate) fn err_recover(&mut self, message: &str, recovery_set: TokenSet) {
|
||||
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
|
||||
if self.at(SyntaxKind::L_CURLY)
|
||||
|| self.at(SyntaxKind::R_CURLY)
|
||||
|| recovery_set.contains(self.current()) {
|
||||
|| recovery.contains(self.current()) {
|
||||
self.error(message);
|
||||
} else {
|
||||
let m = self.start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue