Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/oxc_parser/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ impl<'a> ParserImpl<'a> {
}

pub(crate) fn re_lex_right_angle(&mut self) -> Kind {
if self.fatal_error.is_some() {
return Kind::Eof;
}
let kind = self.cur_kind();
if kind == Kind::RAngle {
self.token = self.lexer.next_right_angle();
Expand All @@ -249,6 +252,9 @@ impl<'a> ParserImpl<'a> {
}

pub(crate) fn re_lex_l_angle(&mut self) -> Kind {
if self.fatal_error.is_some() {
return Kind::Eof;
}
let kind = self.cur_kind();
if matches!(kind, Kind::ShiftLeft | Kind::ShiftLeftEq | Kind::LtEq) {
self.token = self.lexer.re_lex_as_typescript_l_angle(kind);
Expand All @@ -259,6 +265,9 @@ impl<'a> ParserImpl<'a> {
}

pub(crate) fn re_lex_ts_r_angle(&mut self) -> Kind {
if self.fatal_error.is_some() {
return Kind::Eof;
}
let kind = self.cur_kind();
if matches!(kind, Kind::ShiftRight | Kind::ShiftRight3) {
self.token = self.lexer.re_lex_as_typescript_r_angle(kind);
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_parser/src/ts/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ impl<'a> ParserImpl<'a> {
fn parse_type_arguments_of_type_reference(
&mut self,
) -> Option<Box<'a, TSTypeParameterInstantiation<'a>>> {
self.re_lex_l_angle();
if !self.cur_token().is_on_new_line() && self.re_lex_l_angle() == Kind::LAngle {
let span = self.start_span();
self.expect(Kind::LAngle);
Expand Down
1 change: 1 addition & 0 deletions tasks/coverage/misc/fail/oxc-10977.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class{h:<=Ö
8 changes: 7 additions & 1 deletion tasks/coverage/snapshots/parser_misc.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parser_misc Summary:
AST Parsed : 36/36 (100.00%)
Positive Passed: 36/36 (100.00%)
Negative Passed: 33/33 (100.00%)
Negative Passed: 34/34 (100.00%)

× Identifier `b` has already been declared
╭─[misc/fail/oxc-10159.js:1:22]
Expand All @@ -24,6 +24,12 @@ Negative Passed: 33/33 (100.00%)
· ──
╰────

× Unexpected token
╭─[misc/fail/oxc-10977.ts:1:9]
1 │ class{h:<=Ö
· ──
╰────

× Unexpected token
╭─[misc/fail/oxc-169.js:2:1]
1 │ 1<(V=82<<t-j0<(V=$<LBI<(V=ut<I<(V=$<LBI<(V=uIV=82<<t-j0<(V=$<LBI<(V=ut<I<(V=$<LBI<(V<II>
Expand Down
Loading