mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(parser): fix panic in unexpected token
This commit is contained in:
parent
aedaa1a110
commit
48736e53af
1 changed files with 3 additions and 1 deletions
|
|
@ -225,7 +225,9 @@ impl<'a> Parser<'a> {
|
|||
// The lexer should have reported a more meaningful diagnostic
|
||||
// when it is a undetermined kind.
|
||||
if self.cur_kind() == Kind::Undetermined {
|
||||
return self.lexer.errors.pop().unwrap();
|
||||
if let Some(error) = self.lexer.errors.pop() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
diagnostics::UnexpectedToken(self.cur_token().span()).into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue