Repository: swc-project/swc (rust)

Issue:
Async Function isn't Transpiled by Swc
### Describe the bug

The async function of poc.js didn't transpiled by swc.
We can see **async function** is still exist at **line 30**

### Input code

```typescript
class Foo {
    bar(x = async () => await 1) {
    }
}
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6",
    "strict": false,
    "strictMode": false,
    "lazy": false,
    "noInterop": false
  },
  "minify": false
}
```


### Playground link

https://play.swc.rs/?version=1.2.239&code=H4sIAAAAAAAAA0vOSSwuVnDLz1eo5lIAgqTEIo0KBVuFxOLKvGQFDU0FWzuFxPLEzBIFQ02oklquWgAitkoqNgAAAA%3D%3D&config=H4sIAAAAAAAAA0WMSwrDMAxE76K1t93kDj2EcJXg4B8aBWqM714bUrKSmPdmOp3wtHWqrBBdH1o2%2FtJG4hPDa6hGbmoz2jlChiNjPcSWgtdksRTITR2lkMPe1pIvqaoAD%2BJ8xL855lAqn2sFnazVeVcllXyCxjN0lwPet216yfgBCKaI9boAAAA%3D

### Expected behavior

Async () can be transpiled by swc.

### Actual behavior

_No response_

### Version

1.2.239

### Additional context

_No response_

Pull request description:
fix(es/compat): Handle async in class method params
<!-- Note: CI script will automatically rebase your PR so please do not rebase unless required -->

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**Description:**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**BREAKING CHANGE:**

<!--
If this PR introduces a breaking change, it must contain a notice for it to be included in the CHANGELOG. Add description or remove entirely if not breaking.

You may need to update `MIGRATION.md` for the breaking changes.
-->

**Related issue (if exists):**
- fix #5558 

Patch:
diff --git a/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs b/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs
index fb54fba4a4..31aa66e414 100644
--- a/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs
+++ b/crates/swc_ecma_transforms_compat/src/es2017/async_to_generator.rs
@@ -125,6 +125,9 @@ impl<C: Comments> VisitMut for Actual<C> {
         if m.function.body.is_none() {
             return;
         }
+
+        m.visit_mut_children_with(self);
+
         if m.kind != MethodKind::Method || !m.function.is_async {
             return;
         }


Test patch:
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/1/input/.swcrc b/crates/swc/tests/fixture/issues-5xxx/5558/1/input/.swcrc
new file mode 100644
index 0000000000..3551fdade8
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/1/input/.swcrc
@@ -0,0 +1,12 @@
+{
+    "jsc": {
+        "parser": {
+            "syntax": "ecmascript"
+        },
+        "target": "es2016"
+    },
+    "module": {
+        "type": "es6"
+    },
+    "isModule": true
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/1/input/index.js b/crates/swc/tests/fixture/issues-5xxx/5558/1/input/index.js
new file mode 100644
index 0000000000..05f0ee8d79
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/1/input/index.js
@@ -0,0 +1,4 @@
+class Foo {
+    bar(x = async () => await 1) {
+    }
+}
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/1/output/index.js b/crates/swc/tests/fixture/issues-5xxx/5558/1/output/index.js
new file mode 100644
index 0000000000..4c735d8849
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/1/output/index.js
@@ -0,0 +1,6 @@
+import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs";
+class Foo {
+    bar(x = /*#__PURE__*/ _async_to_generator(function*() {
+        return yield 1;
+    })) {}
+}
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/2/input/.swcrc b/crates/swc/tests/fixture/issues-5xxx/5558/2/input/.swcrc
new file mode 100644
index 0000000000..f78f7ff0dc
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/2/input/.swcrc
@@ -0,0 +1,22 @@
+{
+    "jsc": {
+        "parser": {
+            "syntax": "ecmascript",
+            "jsx": false
+        },
+        "target": "es5",
+        "loose": false,
+        "minify": {
+            "compress": false,
+            "mangle": false
+        }
+    },
+    "module": {
+        "type": "es6",
+        "strict": false,
+        "strictMode": false,
+        "lazy": false,
+        "noInterop": false
+    },
+    "minify": false
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/2/input/index.js b/crates/swc/tests/fixture/issues-5xxx/5558/2/input/index.js
new file mode 100644
index 0000000000..05f0ee8d79
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/2/input/index.js
@@ -0,0 +1,4 @@
+class Foo {
+    bar(x = async () => await 1) {
+    }
+}
diff --git a/crates/swc/tests/fixture/issues-5xxx/5558/2/output/index.js b/crates/swc/tests/fixture/issues-5xxx/5558/2/output/index.js
new file mode 100644
index 0000000000..426055b12e
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-5xxx/5558/2/output/index.js
@@ -0,0 +1,32 @@
+import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs";
+import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
+import _create_class from "@swc/helpers/src/_create_class.mjs";
+import regeneratorRuntime from "regenerator-runtime";
+var Foo = function() {
+    "use strict";
+    function Foo() {
+        _class_call_check(this, Foo);
+    }
+    _create_class(Foo, [
+        {
+            key: "bar",
+            value: function bar() {
+                var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _async_to_generator(regeneratorRuntime.mark(function _callee() {
+                    return regeneratorRuntime.wrap(function _callee$(_ctx) {
+                        while(1)switch(_ctx.prev = _ctx.next){
+                            case 0:
+                                _ctx.next = 2;
+                                return 1;
+                            case 2:
+                                return _ctx.abrupt("return", _ctx.sent);
+                            case 3:
+                            case "end":
+                                return _ctx.stop();
+                        }
+                    }, _callee);
+                }));
+            }
+        }
+    ]);
+    return Foo;
+}();