fix(rslint_parser): some recursing forever
MODIFY
crates/rslint_parser/src/syntax/decl.rs
crates/rslint_parser/src/syntax/decl.rs
@@ -22,9 +22,12 @@ pub(super) fn parse_formal_param_pat(p: &mut Parser) -> ParsedSyntax {
}
}
+ let checkpoint = p.checkpoint();
let pat = if let Some(pattern) = pattern(p, true, false) {
pattern
} else {
+ p.rewind(checkpoint);
+
m.abandon(p);
// TODO: not correct in case there was any typescript modifier. Revisit when patterns are refactored
return ParsedSyntax::Absent;

MODIFY
crates/rslint_parser/src/syntax/pat.rs
crates/rslint_parser/src/syntax/pat.rs
@@ -94,13 +94,11 @@ pub fn pattern(p: &mut Parser, parameters: bool, assignment: bool) -> Option<Com
ts = ts.union(token_set![T!['{']]);
}
if parameters {
- ts = ts.union(token_set![T![,], T![')']])
+ ts = ts.union(token_set![T![,], T![')']]);
}
- p.error(err);
- return match ParseRecovery::new(JS_UNKNOWN_PATTERN, ts).recover(p) {
- Ok(recovered) => Some(recovered),
- Err(_) => None,
- };
+ #[allow(deprecated)]
+ SingleTokenParseRecovery::with_error(ts, JS_UNKNOWN_PATTERN, err).recover(p);
+ return None;
}
})
}

fix(rslint_parser): some recursing forever (#1833)