mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(parsr): parse let.a = 1 with error recovery (#1587)
This commit is contained in:
parent
fd6a3ed918
commit
1554f7c0d2
3 changed files with 21 additions and 1 deletions
|
|
@ -31,6 +31,10 @@ impl<'a> Parser<'a> {
|
|||
if peeked.is_assignment_operator() || peeked.is_binary_operator() {
|
||||
let expr = self.parse_assignment_expression_base()?;
|
||||
self.parse_expression_statement(span, expr)
|
||||
// let.a = 1, let()[a] = 1
|
||||
} else if matches!(peeked, Kind::Dot | Kind::LParen) {
|
||||
let expr = self.parse_expression()?;
|
||||
Ok(self.ast.expression_statement(self.end_span(span), expr))
|
||||
// single statement let declaration: while (0) let
|
||||
} else if (stmt_ctx.is_single_statement() && peeked != Kind::LBrack)
|
||||
|| peeked == Kind::Semicolon
|
||||
|
|
|
|||
2
tasks/coverage/misc/fail/oxc.js
Normal file
2
tasks/coverage/misc/fail/oxc.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
let.a = 1;
|
||||
let()[a] = 1;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
parser_misc Summary:
|
||||
AST Parsed : 8/8 (100.00%)
|
||||
Positive Passed: 8/8 (100.00%)
|
||||
Negative Passed: 2/2 (100.00%)
|
||||
Negative Passed: 3/3 (100.00%)
|
||||
× Unexpected token
|
||||
╭─[fail/oxc-169.js:1: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>
|
||||
|
|
@ -13,3 +13,17 @@ Negative Passed: 2/2 (100.00%)
|
|||
· ─────────
|
||||
╰────
|
||||
|
||||
× The keyword 'let' is reserved
|
||||
╭─[fail/oxc.js:1:1]
|
||||
1 │ let.a = 1;
|
||||
· ───
|
||||
2 │ let()[a] = 1;
|
||||
╰────
|
||||
|
||||
× The keyword 'let' is reserved
|
||||
╭─[fail/oxc.js:1:1]
|
||||
1 │ let.a = 1;
|
||||
2 │ let()[a] = 1;
|
||||
· ───
|
||||
╰────
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue