Repository: swc-project/swc (rust)

Issue:
Incorrect minification of *[Symbol.iterator]
### Describe the bug

Two statements collapsed after minification of [this not-so-common code](https://github.com/InteractiveAdvertisingBureau/iabtcf-es/blob/0f4fac2d8209b372c8449027f5d48f44a9dea795/modules/core/src/model/Vector.ts#L21).

### Input code

```javascript
export default class Vector {
  set_ = new Set();

  *[Symbol.iterator]() {
  }
}
```


### Config

```json
{
  "minify": true,
  "jsc": {
    "parser": {
      "syntax": "typescript"
    },
    "transform": {
      "legacyDecorator": true,
      "react": {
        "runtime": "automatic"
      }
    },
    "target": "es2022",
    "loose": false,
    "externalHelpers": true,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  }
}
```


### Playground link

[swc playground](https://play.swc.rs/?version=1.2.218&code=H4sIAAAAAAAAA0utKMgvKlFISU1LLM0pUUjOSSwuVghLTS7JL1Ko5lJQKE4tiVewVchLLVcITi3R0LTmAgpqRQdX5ibl5%2BhllqQWJQKVxmpoglXXctVyAQDTMTiCUgAAAA%3D%3D&config=H4sIAAAAAAAAAz2OMQrDMAxF76I5Q8nQIXOHXkO4SnCxLSPJEGNy99oBdxPS13u%2FQfTJ7xU2k0ILfNXB1iCjKMmYtCbDEzawmkmd%2BGxwLWCCSXeWODKBDnT1RY4FjWWyhNDZuEtJ5iN1CBbjiOYdXAOCclBPAOn6WFdYIDBrz%2B0YtAPoNJKE4U0hk%2BjkzsYNHMcspPr%2FiJiOMAFDEflTxqLd%2FW%2FVs7t%2FVpHNr%2FcAAAA%3D)

### Expected behavior

Code with separate statements, for example with ```;```:
```javascript
export default class Vector{set_=new Set;*[Symbol.iterator](){}}
```

### Actual behavior

```javascript
export default class Vector{set_=new Set*[Symbol.iterator](){}}
```

This code falls with `Uncaught SyntaxError: Unexpected token '{'`

### Version

1.2.218

### Additional context

Version 1.2.148 works good with the result code:

```javascript
class Vector{*[Symbol.iterator](){}constructor(){this.set_=new Set}}export{Vector as default}
```

Pull request:
fix(es/codegen): semicolon for generator function
<!-- 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 #5289 

Patch:
diff --git a/crates/swc_ecma_codegen/src/text_writer/semicolon.rs b/crates/swc_ecma_codegen/src/text_writer/semicolon.rs
index 582783c92b..1d7d6f3ef5 100644
--- a/crates/swc_ecma_codegen/src/text_writer/semicolon.rs
+++ b/crates/swc_ecma_codegen/src/text_writer/semicolon.rs
@@ -68,7 +68,7 @@ impl<W: WriteJs> WriteJs for OmitTrailingSemi<W> {
 
     fn write_punct(&mut self, span: Option<Span>, s: &'static str) -> Result {
         match s {
-            "\"" | "'" | "[" | "!" | "/" | "{" | "(" | "~" | "-" | "+" | "#" | "`" => {
+            "\"" | "'" | "[" | "!" | "/" | "{" | "(" | "~" | "-" | "+" | "#" | "`" | "*" => {
                 self.commit_pending_semi()?;
             }
 


Test patch:
diff --git a/crates/swc_ecma_codegen/tests/fixture/issues/5289/input.js b/crates/swc_ecma_codegen/tests/fixture/issues/5289/input.js
new file mode 100644
index 0000000000..df16add131
--- /dev/null
+++ b/crates/swc_ecma_codegen/tests/fixture/issues/5289/input.js
@@ -0,0 +1,6 @@
+export default class Vector {
+  set_ = new Set();
+
+  *[Symbol.iterator]() {
+  }
+}
\ No newline at end of file
diff --git a/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.js b/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.js
new file mode 100644
index 0000000000..ffa25ef1c6
--- /dev/null
+++ b/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.js
@@ -0,0 +1,4 @@
+export default class Vector {
+    set_ = new Set();
+    *[Symbol.iterator]() {}
+};
diff --git a/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.min.js b/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.min.js
new file mode 100644
index 0000000000..22b94cd0f8
--- /dev/null
+++ b/crates/swc_ecma_codegen/tests/fixture/issues/5289/output.min.js
@@ -0,0 +1,1 @@
+export default class Vector{set_=new Set;*[Symbol.iterator](){}}