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
15 changes: 13 additions & 2 deletions crates/oxc_parser/src/js/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,20 @@ impl<'a> ParserImpl<'a> {
{
return self.parse_variable_declaration_for_statement(span, r#await);
}
// [+Using, +Await] await [no LineTerminator here] using [no LineTerminator here]
if self.cur_kind() == Kind::Await
&& !self.peek_token().is_on_new_line()
&& self.peek_kind() == Kind::Using
&& !self.nth(2).is_on_new_line()
{
return self.parse_using_declaration_for_statement(span, r#await);
}

if (self.cur_kind() == Kind::Await && self.peek_kind() == Kind::Using)
|| (self.cur_kind() == Kind::Using && self.peek_kind() == Kind::Ident)
// [+Using] using [no LineTerminator here] ForBinding[?Yield, ?Await, ~Pattern]
if self.cur_kind() == Kind::Using
&& !self.peek_token().is_on_new_line()
&& self.peek_kind() != Kind::Of
&& self.peek_kind().is_binding_identifier()
{
return self.parse_using_declaration_for_statement(span, r#await);
}
Expand Down
9 changes: 9 additions & 0 deletions tasks/coverage/misc/pass/oxc-10981.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
using using = of;
}
{
for (using using of of) {}
}
{
for (using foo of of) {}
}
4 changes: 2 additions & 2 deletions tasks/coverage/snapshots/codegen_misc.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
codegen_misc Summary:
AST Parsed : 35/35 (100.00%)
Positive Passed: 35/35 (100.00%)
AST Parsed : 36/36 (100.00%)
Positive Passed: 36/36 (100.00%)
4 changes: 2 additions & 2 deletions tasks/coverage/snapshots/parser_misc.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parser_misc Summary:
AST Parsed : 35/35 (100.00%)
Positive Passed: 35/35 (100.00%)
AST Parsed : 36/36 (100.00%)
Positive Passed: 36/36 (100.00%)
Negative Passed: 33/33 (100.00%)

× Identifier `b` has already been declared
Expand Down
4 changes: 2 additions & 2 deletions tasks/coverage/snapshots/semantic_misc.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
semantic_misc Summary:
AST Parsed : 35/35 (100.00%)
Positive Passed: 20/35 (57.14%)
AST Parsed : 36/36 (100.00%)
Positive Passed: 21/36 (58.33%)
semantic Error: tasks/coverage/misc/pass/oxc-1288.ts
Bindings mismatch:
after transform: ScopeId(0): ["from"]
Expand Down
4 changes: 2 additions & 2 deletions tasks/coverage/snapshots/transformer_misc.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
transformer_misc Summary:
AST Parsed : 35/35 (100.00%)
Positive Passed: 35/35 (100.00%)
AST Parsed : 36/36 (100.00%)
Positive Passed: 36/36 (100.00%)
3 changes: 1 addition & 2 deletions tasks/prettier_conformance/snapshots/prettier.js.snap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
js compatibility: 236/699 (33.76%)
js compatibility: 237/699 (33.91%)

# Failed

Expand Down Expand Up @@ -219,7 +219,6 @@ js compatibility: 236/699 (33.76%)
| js/explicit-resource-management/using-declarations.js | 💥 | 80.00% |
| js/explicit-resource-management/valid-await-using-comments.js | 💥 | 60.61% |
| js/explicit-resource-management/valid-using-as-identifier-for-init.js | 💥 | 0.00% |
| js/explicit-resource-management/valid-using-binding-using.js | 💥 | 0.00% |
| js/export/blank-line-between-specifiers.js | 💥💥 | 95.00% |
| js/export-default/function_in_template.js | 💥 | 0.00% |
| js/export-default/iife.js | 💥 | 0.00% |
Expand Down
Loading