refactor(oxc_parser): remove a few unused diagnostics

This commit is contained in:
Boshen 2023-04-15 18:13:15 +08:00
parent 4939eeab6a
commit fec5aafbf1
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
2 changed files with 1 additions and 22 deletions

View file

@ -23,10 +23,6 @@ pub struct ExpectToken(pub &'static str, pub &'static str, #[label("`{0}` expect
#[error("Invalid escape sequence")]
pub struct InvalidEscapeSequence(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("\\8 and \\9 are not allowed in strict mode")]
pub struct NonOctalDecimalEscapeSequence(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("Invalid Unicode escape sequence")]
pub struct UnicodeEscapeSequence(#[label] pub Span);
@ -77,11 +73,6 @@ pub struct EscapedKeyword(#[label] pub Span);
#[diagnostic(help("Try insert a semicolon here"))]
pub struct AutoSemicolonInsertion(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("'0'-prefixed octal literals and octal escape sequences are deprecated")]
#[diagnostic(help("for octal literals use the '0o' prefix instead"))]
pub struct LegacyOctal(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("Line terminator not permitted before arrow")]
#[diagnostic()]
@ -232,11 +223,6 @@ pub struct TemplateLiteral(#[label] pub Span);
#[diagnostic()]
pub struct EmptyParenthesizedExpression(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("'{0}' keyword is unexpected here")]
#[diagnostic()]
pub struct UnexpectedKeyword(pub &'static str, #[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("Illegal newline after {0}")]
#[diagnostic()]
@ -295,10 +281,3 @@ pub struct ReturnStatementOnlyInFunctionBody(#[label] pub Span);
#[error("TS18007: JSX expressions may not use the comma operator.")]
#[diagnostic(help("Did you mean to write an array?"))]
pub struct JSXExpressionsMayNotUseTheCommaOperator(#[label] pub Span);
#[derive(Debug, Error, Diagnostic)]
#[error("Leading decorators must be attached to a class declaration")]
#[diagnostic()]
pub struct BadLeadingDecorator(
#[label("Leading decorators must be attached to a class declaration")] pub Span,
);

View file

@ -270,7 +270,7 @@ impl<'a> Parser<'a> {
self.error(diagnostics::ForLoopAsyncOf(self.end_span(expr_span)));
}
if is_let_of {
self.error(diagnostics::UnexpectedKeyword("let", self.end_span(expr_span)));
self.error(diagnostics::UnexpectedToken(self.end_span(expr_span)));
}
return self.parse_for_in_or_of_loop(span, r#await, for_stmt_left);
}