Repository: swc-project/swc (rust)

Issue:
`await using(true)` strips the `using`
### Describe the bug

SWC is transpiling the `await using(true)` to `await true`.

It also fails to parse `await using;` (which is valid syntax)

It also successfully transpiles `await using true` (which is invalid syntax) to `await true`

### Input code

```typescript
await using(true);
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "decorators": true
    },
    "target": "es2022",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}
```


### Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.3.92&code=H4sIAAAAAAAAA0ssT8wsUSgtzsxL1ygpKk3VtOYCAHJLyJUTAAAA&config=H4sIAAAAAAAAA2WPMQ7DIAxF95wi8tyhYujQO%2FQQiDgRFQRkO1KjKHcvhEBbdcP%2F4f%2F9t67v4ckG7v2WnmmImhipzUnhdRb9SgrIGpEN2ShwqVQ4o1E7xqYNaAJpCcQJCS14gL1wEE0TSvZDVlelTi9wITD%2BeoG3sx3X72tM8JGQ%2BS%2FU63lybb8kdmcq%2BDAsBzxb5iblght8PtWwZgyWH3Xz6LG%2FAbwaodoxAQAA

### SWC Info output

_No response_

### Expected behavior

Keep the input code exactly the same.

### Actual behavior

`await true;`

### Version

1.3.92

### Additional context

_No response_

Pull request:
fix(es/parser): Fix parsing of `await using`
**Related issue:**

 - Closes #8096

Patch:
diff --git a/crates/swc_ecma_parser/src/parser/expr/ops.rs b/crates/swc_ecma_parser/src/parser/expr/ops.rs
index 8ccac2865a..0873045da9 100644
--- a/crates/swc_ecma_parser/src/parser/expr/ops.rs
+++ b/crates/swc_ecma_parser/src/parser/expr/ops.rs
@@ -330,7 +330,7 @@ impl<I: Tokens> Parser<I> {
         }
 
         if is!(self, "await") {
-            return self.parse_await_expr();
+            return self.parse_await_expr(None);
         }
 
         // UpdateExpression
@@ -361,10 +361,15 @@ impl<I: Tokens> Parser<I> {
         Ok(expr)
     }
 
-    pub(crate) fn parse_await_expr(&mut self) -> PResult<Box<Expr>> {
-        let start = cur_pos!(self);
+    pub(crate) fn parse_await_expr(
+        &mut self,
+        start_of_await_token: Option<BytePos>,
+    ) -> PResult<Box<Expr>> {
+        let start = start_of_await_token.unwrap_or_else(|| cur_pos!(self));
 
-        assert_and_bump!(self, "await");
+        if start_of_await_token.is_none() {
+            assert_and_bump!(self, "await");
+        }
 
         if is!(self, '*') {
             syntax_error!(self, SyntaxError::AwaitStar);
diff --git a/crates/swc_ecma_parser/src/parser/stmt.rs b/crates/swc_ecma_parser/src/parser/stmt.rs
index 6722a85909..d72fc67e31 100644
--- a/crates/swc_ecma_parser/src/parser/stmt.rs
+++ b/crates/swc_ecma_parser/src/parser/stmt.rs
@@ -126,7 +126,9 @@ impl<'a, I: Tokens> Parser<I> {
                 self.emit_err(self.input.cur_span(), SyntaxError::TopLevelAwaitInScript);
             }
 
+            let mut eaten_await = None;
             if peeked_is!(self, "using") {
+                eaten_await = Some(self.input.cur_pos());
                 assert_and_bump!(self, "await");
 
                 let v = self.parse_using_decl(start, true)?;
@@ -135,7 +137,7 @@ impl<'a, I: Tokens> Parser<I> {
                 }
             }
 
-            let expr = self.parse_await_expr()?;
+            let expr = self.parse_await_expr(eaten_await)?;
             let expr = self
                 .include_in_expr(true)
                 .parse_bin_op_recursively(expr, 0)?;


Test patch:
diff --git a/crates/swc/tests/fixture/issues-8xxx/8096/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8096/input/.swcrc
new file mode 100644
index 0000000000..79deba5407
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8096/input/.swcrc
@@ -0,0 +1,20 @@
+{
+    "jsc": {
+        "parser": {
+            "syntax": "typescript",
+            "tsx": false,
+            "decorators": true
+        },
+        "target": "es2022",
+        "loose": false,
+        "minify": {
+            "compress": false,
+            "mangle": false
+        }
+    },
+    "module": {
+        "type": "es6"
+    },
+    "minify": false,
+    "isModule": true
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-8xxx/8096/input/1.js b/crates/swc/tests/fixture/issues-8xxx/8096/input/1.js
new file mode 100644
index 0000000000..2f3bd01fea
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8096/input/1.js
@@ -0,0 +1,1 @@
+await using(true);
diff --git a/crates/swc/tests/fixture/issues-8xxx/8096/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8096/output/1.js
new file mode 100644
index 0000000000..2f3bd01fea
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8096/output/1.js
@@ -0,0 +1,1 @@
+await using(true);