Repository: swc-project/swc (rust)

Issue:
Incorrect /*#__PURE__*/ comment positioning
### Describe the bug

When compiling to ES2015 or higher `/*#__PURE__*/ ` comments added by swc have incorrect positioning

### Input code

```typescript
export const SearchLayoutRoot = ({
    children,
    sx,
    ...others
}: SearchLayoutRootProps) => (
    <Box sx={[styles, ...packSX(sx)]} {...others}>
        {children}
    </Box>
);
```


### Config

```json
{
    "sourceMaps": false,
    "jsc": {
        "parser": {
          "syntax": "typescript",
          "tsx": true
        },
        "transform": {
            "react": {
                "runtime": "automatic",
                "refresh": true,
                "importSource": "@emotion/react",
            },
            "legacyDecorator": true,
        },
        "target": "es2015",
        "loose": true,
        "minify": {
          "compress": false,
          "mangle": false
        },
    },
    "isModule": true,
    "module": {
      "type": "es6"
    },
    "minify": false
}
```


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

https://play.swc.rs/?version=1.3.95&code=H4sIAAAAAAAAA0utKMgvKlFIzs8rLlEITk0sSs7wSazMLy0Jys8vUbBV0KjmUgCC5IzMnJSi1DwdMK%2B4AkLr6enll2SkFhVz1VphaA4oyi8o1lSwtVPQACu2ccqvAOq0rY4uLqnMSS3WAWkvSEzODo7QKK7QjK1VqIabV2sH1gIC1TCrayGm6AONsePStOYCAISuhxy6AAAA&config=H4sIAAAAAAAAA21Ru27DMAzc%2BxUB5wB9AMnQqUPXTP0CQqVdFZYokDRQI%2FC%2FV7ZiN7KrReAdecfH9eGQHyj34uiCSeH10GCndCzEt7qMXOdgBhKKklTYVD9Ew5%2BMgg2J1IlPBsf7DNOJNulpRce%2FBDDBqA1L2ChnSgid7eBC9dF8oMkXe%2BOA5l1lu0o0Qvp1a%2BCfBB8Si33MW5jU3iiweY6PxbyuGOsQOmrRDe%2FkWNBYdi7VnCgtTdMA6cvT8%2BlOGjpmpV01BB99M2w37jikPNPmXksJxrajhdo2cvvA64U%2F%2B662hLBgi9180tLxGSqBtbNiM%2F4CzPG%2B5k0CAAA%3D

### SWC Info output

_No response_

### Expected behavior

Output code is something like this:

```jsx
export const SearchLayoutRoot = (_param)=>{
    var { children, sx } = _param, others = _object_without_properties_loose(_param, [
        "children",
        "sx"
    ]);
    return /*#__PURE__*/ _jsx(Box, _extends({
        sx: [
            styles,
            ...packSX(sx)
        ]
    }, others, {
        children: children
    }));
};
```

### Actual behavior

Output code has incorrect `#__PURE__` comment positioning:

```jsx
export const SearchLayoutRoot = (_param)=>/*#__PURE__*/ {
    var { children, sx } = _param, others = _object_without_properties_loose(_param, [
        "children",
        "sx"
    ]);
    return _jsx(Box, _extends({
        sx: [
            styles,
            ...packSX(sx)
        ]
    }, others, {
        children: children
    }));
};
```

### Version

1.3.95

### Additional context

_No response_

Pull request description:
fix(es/compat): Preserve comment for arrow body
<!-- 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):**
Closes #8419 

Patch:
diff --git a/crates/swc_ecma_compat_common/src/macros.rs b/crates/swc_ecma_compat_common/src/macros.rs
index a25da938dc..fa95706d5a 100644
--- a/crates/swc_ecma_compat_common/src/macros.rs
+++ b/crates/swc_ecma_compat_common/src/macros.rs
@@ -24,7 +24,6 @@ macro_rules! impl_visit_mut_fn {
                 BlockStmtOrExpr::Expr(..) => true,
                 _ => false,
             };
-            let body_span = f.body.span();
             let (params, mut body) = self.visit_mut_fn_like(
                 &mut f
                     .params
@@ -39,7 +38,7 @@ macro_rules! impl_visit_mut_fn {
                 &mut match &mut *f.body {
                     BlockStmtOrExpr::BlockStmt(block) => block.take(),
                     BlockStmtOrExpr::Expr(expr) => BlockStmt {
-                        span: body_span,
+                        span: DUMMY_SP,
                         stmts: vec![Stmt::Return(ReturnStmt {
                             span: DUMMY_SP,
                             arg: Some(expr.take()),


Test patch:
diff --git a/crates/swc/tests/fixture/issues-8xxx/8419/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8419/input/.swcrc
new file mode 100644
index 0000000000..55c45f0443
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8419/input/.swcrc
@@ -0,0 +1,22 @@
+{
+    "jsc": {
+        "parser": {
+          "syntax": "typescript",
+          "tsx": true
+        },
+        "transform": {
+            "react": {
+                "runtime": "automatic",
+                "refresh": true,
+                "importSource": "@emotion/react"
+            }
+        },
+        "target": "es2015",
+        "loose": true
+    },
+    "isModule": true,
+    "module": {
+      "type": "es6"
+    },
+    "minify": false
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-8xxx/8419/input/index.js b/crates/swc/tests/fixture/issues-8xxx/8419/input/index.js
new file mode 100644
index 0000000000..2bc4225c79
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8419/input/index.js
@@ -0,0 +1,9 @@
+export const SearchLayoutRoot = ({
+    children,
+    sx,
+    ...others
+}: SearchLayoutRootProps) => (
+    <Box sx={[styles, ...packSX(sx)]} {...others}>
+        {children}
+    </Box>
+);
diff --git a/crates/swc/tests/fixture/issues-8xxx/8419/output/index.js b/crates/swc/tests/fixture/issues-8xxx/8419/output/index.js
new file mode 100644
index 0000000000..ab60d39a93
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8419/output/index.js
@@ -0,0 +1,17 @@
+import { _ as _extends } from "@swc/helpers/_/_extends";
+import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
+import { jsx as _jsx } from "@emotion/react/jsx-runtime";
+export const SearchLayoutRoot = (_param)=>{
+    var { children, sx } = _param, others = _object_without_properties_loose(_param, [
+        "children",
+        "sx"
+    ]);
+    return /*#__PURE__*/ _jsx(Box, _extends({
+        sx: [
+            styles,
+            ...packSX(sx)
+        ]
+    }, others, {
+        children: children
+    }));
+};
diff --git a/crates/swc/tests/vercel/loader-only/next-33291/1-automatic/output/index.js b/crates/swc/tests/vercel/loader-only/next-33291/1-automatic/output/index.js
index 8b25da1d2f..343cf2e344 100644
--- a/crates/swc/tests/vercel/loader-only/next-33291/1-automatic/output/index.js
+++ b/crates/swc/tests/vercel/loader-only/next-33291/1-automatic/output/index.js
@@ -39,11 +39,11 @@ export default function Home() {
                         lineNumber: 15,
                         columnNumber: 17
                     }, this),
-                    icon.map(function(_param) /*#__PURE__*/ {
+                    icon.map(function(_param) {
                         var href = _param.href, linkProps = _object_without_properties(_param, [
                             "href"
                         ]);
-                        return _createElement("link", _object_spread_props(_object_spread({
+                        return /*#__PURE__*/ _createElement("link", _object_spread_props(_object_spread({
                             href: href
                         }, linkProps), {
                             rel: "icon",
diff --git a/crates/swc/tests/vercel/loader-only/next-33291/2-classic/output/index.js b/crates/swc/tests/vercel/loader-only/next-33291/2-classic/output/index.js
index c61b5a3ce4..c5f0f6436f 100644
--- a/crates/swc/tests/vercel/loader-only/next-33291/2-classic/output/index.js
+++ b/crates/swc/tests/vercel/loader-only/next-33291/2-classic/output/index.js
@@ -48,11 +48,11 @@ export default function Home() {
             columnNumber: 17
         },
         __self: this
-    }), icon.map(function(_param) /*#__PURE__*/ {
+    }), icon.map(function(_param) {
         var href = _param.href, linkProps = _object_without_properties(_param, [
             "href"
         ]);
-        return React.createElement("link", _object_spread_props(_object_spread({
+        return /*#__PURE__*/ React.createElement("link", _object_spread_props(_object_spread({
             href: href
         }, linkProps), {
             rel: "icon",