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
12 changes: 9 additions & 3 deletions crates/oxc_parser/src/js/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,16 @@ impl<'a> ParserImpl<'a> {
kind if kind.is_identifier_name() => {
self.parse_static_member_expression(lhs_span, lhs, true)?
}
Kind::Eof => {
return Err(diagnostics::unexpected_end(self.cur_token().span()));
Kind::Bang
| Kind::LAngle
| Kind::LParen
| Kind::NoSubstitutionTemplate
| Kind::ShiftLeft
| Kind::TemplateHead
| Kind::LBrack => break,
_ => {
return Err(diagnostics::unexpected_token(self.cur_token().span()));
}
_ => break,
}
}
// computed member expression is not allowed in decorator
Expand Down
1 change: 1 addition & 0 deletions tasks/coverage/misc/fail/oxc-9525-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x?.;
1 change: 1 addition & 0 deletions tasks/coverage/misc/fail/oxc-9525-2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[x?.];
3 changes: 3 additions & 0 deletions tasks/coverage/misc/fail/oxc-9525-3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
() => {
x?.
}
24 changes: 22 additions & 2 deletions 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 : 32/32 (100.00%)
Positive Passed: 32/32 (100.00%)
Negative Passed: 27/27 (100.00%)
Negative Passed: 30/30 (100.00%)

× Unexpected token
╭─[misc/fail/oxc-169.js:2:1]
Expand Down Expand Up @@ -272,13 +272,33 @@ Negative Passed: 27/27 (100.00%)
5 │ }
╰────

× Unexpected end of file
× Unexpected token
╭─[misc/fail/oxc-9497.js:2:8]
1 │ let repro = {};
2 │ repro.f?.
· ──
╰────

× Unexpected token
╭─[misc/fail/oxc-9525-1.js:1:2]
1 │ x?.;
· ──
╰────

× Unexpected token
╭─[misc/fail/oxc-9525-2.js:1:3]
1 │ [x?.];
· ──
╰────

× Unexpected token
╭─[misc/fail/oxc-9525-3.js:2:4]
1 │ () => {
2 │ x?.
· ──
3 │ }
╰────

× The keyword 'let' is reserved
╭─[misc/fail/oxc.js:3:1]
2 │
Expand Down
Loading