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
4 changes: 0 additions & 4 deletions crates/oxc_parser/src/js/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,6 @@ impl<'a> ParserImpl<'a> {
// for (a.b in ...), for ([a] in ..), for ({a} in ..)
if self.at(Kind::In) || self.at(Kind::Of) {
let target = AssignmentTarget::cover(init_expression, self);
if self.fatal_error.is_some() {
let span = self.end_span(expr_span);
self.fatal_error.as_mut().unwrap().error = diagnostics::unexpected_token(span);
}
let for_stmt_left = ForStatementLeft::from(target);
if !r#await && is_async_of {
self.error(diagnostics::for_loop_async_of(self.end_span(expr_span)));
Expand Down
2 changes: 2 additions & 0 deletions tasks/coverage/misc/fail/oxc-10638.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for(
in
34 changes: 17 additions & 17 deletions tasks/coverage/snapshots/parser_babel.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1815,10 +1815,10 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ─
╰────

× Unexpected token
╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/374/input.js:1:5]
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/374/input.js:1:6]
1 │ for((1 + 1) in list) process(x);
· ───────
· ─────
╰────

× Expected `]` but found `EOF`
Expand Down Expand Up @@ -2090,13 +2090,13 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ╰── `;` expected
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/417/input.js:1:6]
1 │ for (i + 1 in {});
· ─────
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/418/input.js:1:6]
1 │ for (+i in {});
· ──
Expand Down Expand Up @@ -2920,7 +2920,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
╰────
help: Try insert a semicolon here

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-for-in-init-concise-binary-in/input.js:1:6]
1 │ for (() => x in y;;);
· ───────
Expand Down Expand Up @@ -3141,7 +3141,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
4 │ })
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/input.js:2:6]
1 │ var a;
2 │ for (a = 0 in {});
Expand Down Expand Up @@ -3179,7 +3179,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ───────────
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/input.js:2:6]
1 │ var a;
2 │ for (a = 0 of {});
Expand Down Expand Up @@ -4994,7 +4994,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ─────
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/input.js:2:8]
1 │ function* g() {
2 │ for (yield '' in {}; ; ) ;
Expand Down Expand Up @@ -5777,7 +5777,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
3 │ }
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-async-of-arrow/input.js:2:14]
1 │ async function f() {
2 │ for await (async of => {} of x);
Expand Down Expand Up @@ -6357,7 +6357,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
5 │ }
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/es2021/for-async-of/forbidden-arrow-function/input.js:1:6]
1 │ for (async of => {} of x);
· ──────────────
Expand Down Expand Up @@ -9033,7 +9033,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ─────────
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/input.js:1:6]
1 │ for (this of that);
· ────
Expand Down Expand Up @@ -10194,10 +10194,10 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ─
╰────

× Unexpected token
╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/input.js:1:5]
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/input.js:1:6]
1 │ for((1 + 1) in list) process(x);
· ───────
· ─────
╰────

× Expected `]` but found `EOF`
Expand Down Expand Up @@ -10577,13 +10577,13 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
· ╰── `;` expected
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/input.js:1:6]
1 │ for (i + 1 in {});
· ─────
╰────

× Unexpected token
× Cannot assign to this expression
╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/input.js:1:6]
1 │ for (+i in {});
· ──
Expand Down
9 changes: 8 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 : 35/35 (100.00%)
Positive Passed: 35/35 (100.00%)
Negative Passed: 31/31 (100.00%)
Negative Passed: 32/32 (100.00%)

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

× Unexpected token
╭─[misc/fail/oxc-10638.js:2:1]
1 │ for(
2 │ in
· ──
╰────

× 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
Loading