Repository: swc-project/swc (rust)

Issue:
Wrong position for __PURE__ annotation
### Describe the bug

Happens when swc is used with Env Targets `safari >= 15`

### Input code

```typescript
export const IconSpecHotkey = ({ icon }) =>
  <div>{icon}</div>
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true
    },
    "externalHelpers": true,
    "transform": {
      "react": {
        "runtime": "automatic"
      }
    },
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "minify": false,
  "module": {
    "type": "es6"
  },
  "env": {
    "targets": "safari>15"
  }
}
```


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

https://play.swc.rs/?version=1.3.96-nightly-20231030.1&code=H4sIAAAAAAAAA0utKMgvKlFIzs8rLlHwBFLBBanJHvkl2amVCrYKGtUKmUAxhVpNBVs7LgUFm5TMMrtqkFCtjT6IDQCn2S2YPwAAAA%3D%3D&config=H4sIAAAAAAAAA1WQvQ7CMAyE9z5F5ZmFAQYGZl7DCm4VlD%2FZLmqF%2Bu40pQ3pFt9954v8adoWXmLg1n6W5zIkZCEu86LIFBTHRQGdEolhmxROu6uSLeWBVmX%2BGUCjEgd0D3KJWDZkM5UxSBfZ1zVMaLQSsjQEtZ5yNQ4aPao1sNnzoc7FKJnr0Mne4m2w3VRXmOgTk8gRzCiG3pV8s%2B9ft%2F%2F3lAz4%2BBxWfjtaPkz%2BJckVSo7CuyKQe9LcDIIdsr2fLyvazF9lW%2BWahAEAAA%3D%3D

### SWC Info output

_No response_

### Expected behavior

Correct placement of annotation [as without env.targets](https://play.swc.rs/?version=1.3.96-nightly-20231030.1&code=H4sIAAAAAAAAA0utKMgvKlFIzs8rLlHwBFLBBanJHvkl2amVCrYKGtUKmUAxhVpNBVs7LgUFm5TMMrtqkFCtjT6IDQCn2S2YPwAAAA%3D%3D&config=H4sIAAAAAAAAA1VQyw6DMAy78xWo55132BfsN6IuTJ36UpJKINR%2FX8MKg1tiO7aVdRhH82FrHuPaxrZkIEY69obwEgXmhhhZMrIll8XcdlZYKaGCG1J%2FhMFZkCL4J%2FqMxF3SSSGIPCUK5xhCsHICFCpRXECNhiIpgDhrOl0vcT4lVt0EnveU4KKblnOETSETMl%2BFKoX49sf9sPtv7n%2Bf48aE9Cqbvj9NH6Mtke%2Farw71C17bKlVZAQAA)
```
import { jsx as _jsx } from "react/jsx-runtime";
export var IconSpecHotkey = function(param) {
    var icon = param.icon;
    return /*#__PURE__*/ _jsx("div", {
        children: icon
    });
};
```



### Actual behavior

```
import { jsx as _jsx } from "react/jsx-runtime";
export const IconSpecHotkey = (param)=>/*#__PURE__*/ {
    let { icon } = param;
    return _jsx("div", {
        children: icon
    });
};
```

### Version

1.3.96-nightly-20231030.1

### Additional context

Actual `__PURE__` annotation does not work together with rollup 4: [repl](https://rollupjs.org/repl/?version=4.1.5&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGpzeCUyMGFzJTIwX2pzeCUyMCU3RCUyMGZyb20lMjAlNUMlMjJyZWFjdCUyRmpzeC1ydW50aW1lJTVDJTIyJTNCJTVDbmV4cG9ydCUyMGNvbnN0JTIwSWNvblNwZWNIb3RrZXklMjAlM0QlMjAocGFyYW0pJTNEJTNFJTJGKiUyM19fUFVSRV9fKiUyRiUyMCU3QiU1Q24lMjAlMjAlMjAlMjBsZXQlMjAlN0IlMjBpY29uJTIwJTdEJTIwJTNEJTIwcGFyYW0lM0IlNUNuJTIwJTIwJTIwJTIwcmV0dXJuJTIwX2pzeCglNUMlMjJkaXYlNUMlMjIlMkMlMjAlN0IlNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY2hpbGRyZW4lM0ElMjBpY29uJTVDbiUyMCUyMCUyMCUyMCU3RCklM0IlNUNuJTdEJTNCJTVDbiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTJDJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlN0QlMkMlMjJ0cmVlc2hha2UlMjIlM0F0cnVlJTdEJTdE)

> A comment `"/*#__PURE__*/"` in "main.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues. 

Desired annotation works fine: [repl](https://rollupjs.org/repl/?version=4.1.5&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGpzeCUyMGFzJTIwX2pzeCUyMCU3RCUyMGZyb20lMjAlNUMlMjJyZWFjdCUyRmpzeC1ydW50aW1lJTVDJTIyJTNCJTVDbmV4cG9ydCUyMHZhciUyMEljb25TcGVjSG90a2V5JTIwJTNEJTIwZnVuY3Rpb24ocGFyYW0pJTIwJTdCJTVDbiUyMCUyMCUyMCUyMHZhciUyMGljb24lMjAlM0QlMjBwYXJhbS5pY29uJTNCJTVDbiUyMCUyMCUyMCUyMHJldHVybiUyMCUyRiolMjNfX1BVUkVfXyolMkYlMjBfanN4KCU1QyUyMmRpdiU1QyUyMiUyQyUyMCU3QiU1Q24lMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjaGlsZHJlbiUzQSUyMGljb24lNUNuJTIwJTIwJTIwJTIwJTdEKSUzQiU1Q24lN0QlM0IlNUNuJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlMkMlMjJuYW1lJTIyJTNBJTIybWFpbi5qcyUyMiU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJvdXRwdXQlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJlcyUyMiU3RCUyQyUyMnRyZWVzaGFrZSUyMiUzQXRydWUlN0QlN0Q=)

Pull request:
fix(es/compat): Use dummy span for blocks in `parameters`
**Description:**


**Related issue:**

 - Closes #8199

Patch:
diff --git a/crates/swc_ecma_compat_es2015/src/parameters.rs b/crates/swc_ecma_compat_es2015/src/parameters.rs
index cfa3e68b69..0d03d8fcb0 100644
--- a/crates/swc_ecma_compat_es2015/src/parameters.rs
+++ b/crates/swc_ecma_compat_es2015/src/parameters.rs
@@ -353,7 +353,7 @@ impl Params {
                             arg: Box::new(idx_ident.clone().into()),
                         }))),
                         body: Box::new(Stmt::Block(BlockStmt {
-                            span,
+                            span: DUMMY_SP,
                             stmts: vec![{
                                 let prop = Box::new(Expr::Ident(idx_ident.clone()));
                                 // a1[_key - i] = arguments[_key];
@@ -582,7 +582,6 @@ impl VisitMut for Params {
                     }
                 }
 
-                let body_span = f.body.span();
                 let mut params = f
                     .params
                     .take()
@@ -597,7 +596,7 @@ impl VisitMut for Params {
                 let mut body = match *f.body.take() {
                     BlockStmtOrExpr::BlockStmt(block) => block,
                     BlockStmtOrExpr::Expr(expr) => BlockStmt {
-                        span: body_span,
+                        span: DUMMY_SP,
                         stmts: vec![Stmt::Return(ReturnStmt {
                             span: DUMMY_SP,
                             arg: Some(expr),


Test patch:
diff --git a/crates/swc/tests/fixture/issues-8xxx/8199/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8199/input/.swcrc
new file mode 100644
index 0000000000..ac5ebe4afb
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8199/input/.swcrc
@@ -0,0 +1,26 @@
+{
+    "jsc": {
+        "parser": {
+            "syntax": "typescript",
+            "tsx": true
+        },
+        "externalHelpers": true,
+        "transform": {
+            "react": {
+                "runtime": "automatic"
+            }
+        },
+        "loose": false,
+        "minify": {
+            "compress": false,
+            "mangle": false
+        }
+    },
+    "minify": false,
+    "module": {
+        "type": "es6"
+    },
+    "env": {
+        "targets": "safari>15"
+    }
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-8xxx/8199/input/1.js b/crates/swc/tests/fixture/issues-8xxx/8199/input/1.js
new file mode 100644
index 0000000000..cd305a8210
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8199/input/1.js
@@ -0,0 +1,2 @@
+export const IconSpecHotkey = ({ icon }) =>
+    <div>{icon}</div>
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-8xxx/8199/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8199/output/1.js
new file mode 100644
index 0000000000..ea1836b77e
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-8xxx/8199/output/1.js
@@ -0,0 +1,7 @@
+import { jsx as _jsx } from "react/jsx-runtime";
+export const IconSpecHotkey = (param)=>{
+    let { icon } = param;
+    return /*#__PURE__*/ _jsx("div", {
+        children: icon
+    });
+};