Repository: swc-project/swc (rust)

Issue:
Invalid variable assignment name change in ES5 with eval
### Describe the bug

The compiled code assigns a variable that doesn't exist `bmRnd1`. The variable declaration isn't renamed to match the assignment. I ran into this with `lottie-web@5.7.12` (build/player/lottie.js file). Upgrading that dependency fixed the problem (bmRnd is just a function definition in the updated code).

### Input code

```typescript
var bmRnd;
function a() {
  bmRnd = function () {};
}
eval('');
```


### Config

```json
{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es5",
  }
}
```


### Playground link

https://play.swc.rs/?version=1.3.49&code=H4sIAAAAAAAAAz2KTQqAIBBG93OKb6eeYegSLdpbagQ2gqmb8O4JQsv302zGfq%2FimChUOcqVBDlVcZuN1T86RHsavIS5YcG%2F6WbjTED2pWbBMDy4M3UiP0grZfgDK1lJ%2FmUAAAA%3D&config=H4sIAAAAAAAAA6vmUlBQyipOVrJSqAYygZyCxKLi1CI4HyhSXJlXklgBFFFKTc5NLE4uyiwoUdKByWYVg6TSEnOKU8FCtRAZpZLEovTUErCuYlOw8lquWgDsxhJabwAAAA%3D%3D

### Expected behavior

swc should rename (or not rename?) both the variable declaration and the variable assignment to `bmRnd`.

### Actual behavior

swc renames the variable assignment to a different name from the variable declaration. This results in a runtime error for the built code.

### Version

1.3.46

### Additional context

I'm not 100% sure if this is expected in ES5 with eval (maybe it is?).

Pull request description:
fix: reserved function name should be private
<!-- 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:**

Fixes #7253

<!-- 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):**


Patch:
diff --git a/crates/swc_ecma_transforms_compat/src/es2015/function_name.rs b/crates/swc_ecma_transforms_compat/src/es2015/function_name.rs
index 85cf0d152f..0ad7421dea 100644
--- a/crates/swc_ecma_transforms_compat/src/es2015/function_name.rs
+++ b/crates/swc_ecma_transforms_compat/src/es2015/function_name.rs
@@ -1,4 +1,4 @@
-use swc_common::util::take::Take;
+use swc_common::{util::take::Take, DUMMY_SP};
 use swc_ecma_ast::*;
 use swc_ecma_transforms_base::perf::Parallel;
 use swc_ecma_utils::{private_ident, IdentUsageFinder};
@@ -118,7 +118,7 @@ macro_rules! impl_for {
                         // self.name = Some(name);
                         node.ident = None;
                     } else {
-                        node.ident = Some(name);
+                        node.ident = Some(private_ident!(DUMMY_SP, name.sym));
                     }
                 }
             }


Test patch:
diff --git a/crates/swc/tests/fixture/issues-1xxx/1681/es3/output/input.js b/crates/swc/tests/fixture/issues-1xxx/1681/es3/output/input.js
index 5270266cfb..2fe4cb3a0a 100644
--- a/crates/swc/tests/fixture/issues-1xxx/1681/es3/output/input.js
+++ b/crates/swc/tests/fixture/issues-1xxx/1681/es3/output/input.js
@@ -14,7 +14,7 @@ function _templateObject1() {
     ], [
         "a\\nb\\nc\\n"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/fixture/issues-1xxx/1681/es5/output/input.js b/crates/swc/tests/fixture/issues-1xxx/1681/es5/output/input.js
index 5270266cfb..2fe4cb3a0a 100644
--- a/crates/swc/tests/fixture/issues-1xxx/1681/es5/output/input.js
+++ b/crates/swc/tests/fixture/issues-1xxx/1681/es5/output/input.js
@@ -14,7 +14,7 @@ function _templateObject1() {
     ], [
         "a\\nb\\nc\\n"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/fixture/issues-1xxx/1742/case1/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1742/case1/output/index.js
index a816b9dbc1..b31336bcae 100644
--- a/crates/swc/tests/fixture/issues-1xxx/1742/case1/output/index.js
+++ b/crates/swc/tests/fixture/issues-1xxx/1742/case1/output/index.js
@@ -17,7 +17,7 @@ function _templateObject1() {
     var data = _tagged_template_literal([
         "tagged template"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/fixture/issues-2xxx/2468/1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2468/1/output/index.js
index 4d7a9068aa..80c48321cd 100644
--- a/crates/swc/tests/fixture/issues-2xxx/2468/1/output/index.js
+++ b/crates/swc/tests/fixture/issues-2xxx/2468/1/output/index.js
@@ -12,7 +12,7 @@ function _templateObject1() {
     var data = _tagged_template_literal([
         "2"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/fixture/issues-5xxx/5068/1/output/index.js b/crates/swc/tests/fixture/issues-5xxx/5068/1/output/index.js
index 47e05eca3d..df157fafe3 100644
--- a/crates/swc/tests/fixture/issues-5xxx/5068/1/output/index.js
+++ b/crates/swc/tests/fixture/issues-5xxx/5068/1/output/index.js
@@ -12,7 +12,7 @@ function _templateObject1() {
     var data = _tagged_template_literal([
         "\n  position: absolute;\n"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/fixture/issues-5xxx/5556/output/index.js b/crates/swc/tests/fixture/issues-5xxx/5556/output/index.js
index a2ac04320d..2aa981bd34 100644
--- a/crates/swc/tests/fixture/issues-5xxx/5556/output/index.js
+++ b/crates/swc/tests/fixture/issues-5xxx/5556/output/index.js
@@ -1,7 +1,7 @@
 import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
 var app;
 var ctx;
-x = function x() {
+x = function x1() {
     var y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(app) {
         return {
             schedule: {
diff --git a/crates/swc/tests/fixture/issues-7xxx/7253/input/.swcrc b/crates/swc/tests/fixture/issues-7xxx/7253/input/.swcrc
new file mode 100644
index 0000000000..dc0b8f887b
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-7xxx/7253/input/.swcrc
@@ -0,0 +1,9 @@
+{
+    "jsc": {
+      "parser": {
+        "syntax": "ecmascript",
+        "jsx": false
+      },
+      "target": "es5"
+    }
+}
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-7xxx/7253/input/input.js b/crates/swc/tests/fixture/issues-7xxx/7253/input/input.js
new file mode 100644
index 0000000000..4cb0f47faf
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-7xxx/7253/input/input.js
@@ -0,0 +1,5 @@
+var bmRnd;
+function a() {
+  bmRnd = function () {};
+}
+eval('');
\ No newline at end of file
diff --git a/crates/swc/tests/fixture/issues-7xxx/7253/output/input.js b/crates/swc/tests/fixture/issues-7xxx/7253/output/input.js
new file mode 100644
index 0000000000..afc3fb69ce
--- /dev/null
+++ b/crates/swc/tests/fixture/issues-7xxx/7253/output/input.js
@@ -0,0 +1,5 @@
+var bmRnd;
+function a() {
+    bmRnd = function bmRnd1() {};
+}
+eval("");
diff --git a/crates/swc/tests/tsc-references/asOperator3.1.normal.js b/crates/swc/tests/tsc-references/asOperator3.1.normal.js
index 0325a994f8..470426f853 100644
--- a/crates/swc/tests/tsc-references/asOperator3.1.normal.js
+++ b/crates/swc/tests/tsc-references/asOperator3.1.normal.js
@@ -14,7 +14,7 @@ function _templateObject1() {
     var data = _tagged_template_literal([
         "Hello"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportDoubleAssignmentInClosure.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsExportDoubleAssignmentInClosure.1.normal.js
index dd99c4cd42..859050b845 100644
--- a/crates/swc/tests/tsc-references/jsDeclarationsExportDoubleAssignmentInClosure.1.normal.js
+++ b/crates/swc/tests/tsc-references/jsDeclarationsExportDoubleAssignmentInClosure.1.normal.js
@@ -1,7 +1,7 @@
 //// [index.js]
 // @ts-nocheck
 function foo() {
-    module.exports = exports = function exports(o) {
+    module.exports = exports = function exports1(o) {
         return o == null ? create(base) : defineProperties(Object(o), descriptors);
     };
     var m = function m() {
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js
index d791c0aa7d..e5a60b374f 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js
@@ -14,7 +14,7 @@ function _templateObject1() {
     var data = _tagged_template_literal([
         ""
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
         "",
         ""
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -34,7 +34,7 @@ function _templateObject3() {
         "",
         ""
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
         "",
         ""
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -54,7 +54,7 @@ function _templateObject5() {
         "",
         ""
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
         "",
         ""
     ]);
-    _templateObject6 = function _templateObject6() {
+    _templateObject6 = function _templateObject() {
         return data;
     };
     return data;
@@ -74,7 +74,7 @@ function _templateObject7() {
         "",
         ""
     ]);
-    _templateObject7 = function _templateObject7() {
+    _templateObject7 = function _templateObject() {
         return data;
     };
     return data;
@@ -84,7 +84,7 @@ function _templateObject8() {
         "",
         ""
     ]);
-    _templateObject8 = function _templateObject8() {
+    _templateObject8 = function _templateObject() {
         return data;
     };
     return data;
@@ -95,7 +95,7 @@ function _templateObject9() {
         "",
         ""
     ]);
-    _templateObject9 = function _templateObject9() {
+    _templateObject9 = function _templateObject() {
         return data;
     };
     return data;
@@ -106,7 +106,7 @@ function _templateObject10() {
         "",
         ""
     ]);
-    _templateObject10 = function _templateObject10() {
+    _templateObject10 = function _templateObject() {
         return data;
     };
     return data;
@@ -117,7 +117,7 @@ function _templateObject11() {
         "",
         ""
     ]);
-    _templateObject11 = function _templateObject11() {
+    _templateObject11 = function _templateObject() {
         return data;
     };
     return data;
@@ -128,7 +128,7 @@ function _templateObject12() {
         " ",
         ""
     ]);
-    _templateObject12 = function _templateObject12() {
+    _templateObject12 = function _templateObject() {
         return data;
     };
     return data;
@@ -139,7 +139,7 @@ function _templateObject13() {
         "",
         ""
     ]);
-    _templateObject13 = function _templateObject13() {
+    _templateObject13 = function _templateObject() {
         return data;
     };
     return data;
@@ -150,7 +150,7 @@ function _templateObject14() {
         "",
         ""
     ]);
-    _templateObject14 = function _templateObject14() {
+    _templateObject14 = function _templateObject() {
         return data;
     };
     return data;
@@ -162,7 +162,7 @@ function _templateObject15() {
         "",
         ""
     ]);
-    _templateObject15 = function _templateObject15() {
+    _templateObject15 = function _templateObject() {
         return data;
     };
     return data;
@@ -174,7 +174,7 @@ function _templateObject16() {
         "",
         ""
     ]);
-    _templateObject16 = function _templateObject16() {
+    _templateObject16 = function _templateObject() {
         return data;
     };
     return data;
@@ -186,7 +186,7 @@ function _templateObject17() {
         "",
         ""
     ]);
-    _templateObject17 = function _templateObject17() {
+    _templateObject17 = function _templateObject() {
         return data;
     };
     return data;
@@ -198,7 +198,7 @@ function _templateObject18() {
         "",
         ""
     ]);
-    _templateObject18 = function _templateObject18() {
+    _templateObject18 = function _templateObject() {
         return data;
     };
     return data;
@@ -210,7 +210,7 @@ function _templateObject19() {
         "",
         ""
     ]);
-    _templateObject19 = function _templateObject19() {
+    _templateObject19 = function _templateObject() {
         return data;
     };
     return data;
@@ -222,7 +222,7 @@ function _templateObject20() {
         "",
         ""
     ]);
-    _templateObject20 = function _templateObject20() {
+    _templateObject20 = function _templateObject() {
         return data;
     };
     return data;
@@ -232,7 +232,7 @@ function _templateObject21() {
         "",
         ""
     ]);
-    _templateObject21 = function _templateObject21() {
+    _templateObject21 = function _templateObject() {
         return data;
     };
     return data;
@@ -244,7 +244,7 @@ function _templateObject22() {
         "",
         ""
     ]);
-    _templateObject22 = function _templateObject22() {
+    _templateObject22 = function _templateObject() {
         return data;
     };
     return data;
@@ -256,7 +256,7 @@ function _templateObject23() {
         "",
         ""
     ]);
-    _templateObject23 = function _templateObject23() {
+    _templateObject23 = function _templateObject() {
         return data;
     };
     return data;
@@ -268,7 +268,7 @@ function _templateObject24() {
         "",
         ""
     ]);
-    _templateObject24 = function _templateObject24() {
+    _templateObject24 = function _templateObject() {
         return data;
     };
     return data;
@@ -280,7 +280,7 @@ function _templateObject25() {
         "",
         ""
     ]);
-    _templateObject25 = function _templateObject25() {
+    _templateObject25 = function _templateObject() {
         return data;
     };
     return data;
@@ -292,7 +292,7 @@ function _templateObject26() {
         "",
         ""
     ]);
-    _templateObject26 = function _templateObject26() {
+    _templateObject26 = function _templateObject() {
         return data;
     };
     return data;
@@ -304,7 +304,7 @@ function _templateObject27() {
         "",
         ""
     ]);
-    _templateObject27 = function _templateObject27() {
+    _templateObject27 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.1.normal.js
index 99ff38506e..2cc48a8279 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.1.normal.js
@@ -15,7 +15,7 @@ function _templateObject1() {
         "def",
         "ghi"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
         "def",
         "ghi"
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
         "def",
         "ghi"
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject6 = function _templateObject6() {
+    _templateObject6 = function _templateObject() {
         return data;
     };
     return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
         "def",
         "ghi"
     ]);
-    _templateObject7 = function _templateObject7() {
+    _templateObject7 = function _templateObject() {
         return data;
     };
     return data;
@@ -86,7 +86,7 @@ function _templateObject8() {
         "def",
         "ghi"
     ]);
-    _templateObject8 = function _templateObject8() {
+    _templateObject8 = function _templateObject() {
         return data;
     };
     return data;
@@ -97,7 +97,7 @@ function _templateObject9() {
         "def",
         "ghi"
     ]);
-    _templateObject9 = function _templateObject9() {
+    _templateObject9 = function _templateObject() {
         return data;
     };
     return data;
@@ -108,7 +108,7 @@ function _templateObject10() {
         "def",
         "ghi"
     ]);
-    _templateObject10 = function _templateObject10() {
+    _templateObject10 = function _templateObject() {
         return data;
     };
     return data;
@@ -119,7 +119,7 @@ function _templateObject11() {
         "def",
         "ghi"
     ]);
-    _templateObject11 = function _templateObject11() {
+    _templateObject11 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.1.normal.js
index fd98564e7b..eeb96c032b 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.1.normal.js
@@ -14,7 +14,7 @@ function _templateObject1() {
         "",
         ""
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -25,7 +25,7 @@ function _templateObject2() {
         "",
         ""
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -36,7 +36,7 @@ function _templateObject3() {
         "",
         ""
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -47,7 +47,7 @@ function _templateObject4() {
         "",
         ""
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -59,7 +59,7 @@ function _templateObject5() {
         "",
         ""
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.1.normal.js
index 264ff2c557..b6cac5c0b6 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.1.normal.js
@@ -15,7 +15,7 @@ function _templateObject1() {
         "",
         ""
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js
index 71e83a9cbe..f91899c5aa 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js
@@ -16,7 +16,7 @@ function _templateObject1() {
         "",
         ""
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -27,7 +27,7 @@ function _templateObject2() {
         "",
         ""
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -38,7 +38,7 @@ function _templateObject3() {
         "",
         ""
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -49,7 +49,7 @@ function _templateObject4() {
         "",
         ""
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -60,7 +60,7 @@ function _templateObject5() {
         "",
         ""
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
@@ -70,7 +70,7 @@ function _templateObject6() {
         "",
         ""
     ]);
-    _templateObject6 = function _templateObject6() {
+    _templateObject6 = function _templateObject() {
         return data;
     };
     return data;
@@ -82,7 +82,7 @@ function _templateObject7() {
         "",
         ""
     ]);
-    _templateObject7 = function _templateObject7() {
+    _templateObject7 = function _templateObject() {
         return data;
     };
     return data;
@@ -94,7 +94,7 @@ function _templateObject8() {
         "",
         ""
     ]);
-    _templateObject8 = function _templateObject8() {
+    _templateObject8 = function _templateObject() {
         return data;
     };
     return data;
@@ -104,7 +104,7 @@ function _templateObject9() {
         "",
         ""
     ]);
-    _templateObject9 = function _templateObject9() {
+    _templateObject9 = function _templateObject() {
         return data;
     };
     return data;
@@ -116,7 +116,7 @@ function _templateObject10() {
         "",
         ""
     ]);
-    _templateObject10 = function _templateObject10() {
+    _templateObject10 = function _templateObject() {
         return data;
     };
     return data;
@@ -128,7 +128,7 @@ function _templateObject11() {
         "",
         ""
     ]);
-    _templateObject11 = function _templateObject11() {
+    _templateObject11 = function _templateObject() {
         return data;
     };
     return data;
@@ -137,7 +137,7 @@ function _templateObject12() {
     var data = _tagged_template_literal([
         ""
     ]);
-    _templateObject12 = function _templateObject12() {
+    _templateObject12 = function _templateObject() {
         return data;
     };
     return data;
@@ -148,7 +148,7 @@ function _templateObject13() {
         "",
         ""
     ]);
-    _templateObject13 = function _templateObject13() {
+    _templateObject13 = function _templateObject() {
         return data;
     };
     return data;
@@ -159,7 +159,7 @@ function _templateObject14() {
         "",
         ""
     ]);
-    _templateObject14 = function _templateObject14() {
+    _templateObject14 = function _templateObject() {
         return data;
     };
     return data;
@@ -170,7 +170,7 @@ function _templateObject15() {
         "",
         ""
     ]);
-    _templateObject15 = function _templateObject15() {
+    _templateObject15 = function _templateObject() {
         return data;
     };
     return data;
@@ -181,7 +181,7 @@ function _templateObject16() {
         "",
         ""
     ]);
-    _templateObject16 = function _templateObject16() {
+    _templateObject16 = function _templateObject() {
         return data;
     };
     return data;
@@ -192,7 +192,7 @@ function _templateObject17() {
         "",
         ""
     ]);
-    _templateObject17 = function _templateObject17() {
+    _templateObject17 = function _templateObject() {
         return data;
     };
     return data;
@@ -203,7 +203,7 @@ function _templateObject18() {
         "",
         ""
     ]);
-    _templateObject18 = function _templateObject18() {
+    _templateObject18 = function _templateObject() {
         return data;
     };
     return data;
@@ -214,7 +214,7 @@ function _templateObject19() {
         "",
         ""
     ]);
-    _templateObject19 = function _templateObject19() {
+    _templateObject19 = function _templateObject() {
         return data;
     };
     return data;
@@ -224,7 +224,7 @@ function _templateObject20() {
         "",
         ""
     ]);
-    _templateObject20 = function _templateObject20() {
+    _templateObject20 = function _templateObject() {
         return data;
     };
     return data;
@@ -234,7 +234,7 @@ function _templateObject21() {
         "",
         ""
     ]);
-    _templateObject21 = function _templateObject21() {
+    _templateObject21 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.1.normal.js
index dbc9628e7e..c424c3b2ad 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.1.normal.js
@@ -15,7 +15,7 @@ function _templateObject1() {
         "def",
         "ghi"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
         "def",
         "ghi"
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
         "def",
         "ghi"
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject6 = function _templateObject6() {
+    _templateObject6 = function _templateObject() {
         return data;
     };
     return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
         "def",
         "ghi"
     ]);
-    _templateObject7 = function _templateObject7() {
+    _templateObject7 = function _templateObject() {
         return data;
     };
     return data;
@@ -84,7 +84,7 @@ function _templateObject8() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject8 = function _templateObject8() {
+    _templateObject8 = function _templateObject() {
         return data;
     };
     return data;
@@ -95,7 +95,7 @@ function _templateObject9() {
         "def",
         "ghi"
     ]);
-    _templateObject9 = function _templateObject9() {
+    _templateObject9 = function _templateObject() {
         return data;
     };
     return data;
@@ -106,7 +106,7 @@ function _templateObject10() {
         "def",
         "ghi"
     ]);
-    _templateObject10 = function _templateObject10() {
+    _templateObject10 = function _templateObject() {
         return data;
     };
     return data;
@@ -117,7 +117,7 @@ function _templateObject11() {
         "def",
         "ghi"
     ]);
-    _templateObject11 = function _templateObject11() {
+    _templateObject11 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.1.normal.js
index fba7475b3c..f27c84c88f 100644
--- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.1.normal.js
+++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.1.normal.js
@@ -15,7 +15,7 @@ function _templateObject1() {
         "def",
         "ghi"
     ]);
-    _templateObject1 = function _templateObject1() {
+    _templateObject1 = function _templateObject() {
         return data;
     };
     return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject2 = function _templateObject2() {
+    _templateObject2 = function _templateObject() {
         return data;
     };
     return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
         "def",
         "ghi"
     ]);
-    _templateObject3 = function _templateObject3() {
+    _templateObject3 = function _templateObject() {
         return data;
     };
     return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject4 = function _templateObject4() {
+    _templateObject4 = function _templateObject() {
         return data;
     };
     return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
         "def",
         "ghi"
     ]);
-    _templateObject5 = function _templateObject5() {
+    _templateObject5 = function _templateObject() {
         return data;
     };
     return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
     var data = _tagged_template_literal([
         "abc"
     ]);
-    _templateObject6 = function _templateObject6() {
+    _templateObject6 = function _templateObject() {
         return data;
     };
     return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
         "def",
         "ghi"
     ]);
-    _templateObject7 = function _templateObject7() {
+    _templateObject7 = function _templateObject() {
         return data;
     };
     return data;
@@ -86,7 +86,7 @@ function _templateObject8() {
         "def",
         "ghi"
     ]);
-    _templateObject8 = function _templateObject8() {
+    _templateObject8 = function _templateObject() {
         return data;
     };
     return data;
@@ -97,7 +97,7 @@ function _templateObject9() {
         "def",
         "ghi"
     ]);
-    _templateObject9 = function _templateObject9() {
+    _templateObject9 = function _templateObject() {
         return data;
     };
     return data;
diff --git a/crates/swc_ecma_transforms/tests/es2015_function_name.rs b/crates/swc_ecma_transforms/tests/es2015_function_name.rs
index e390543040..4196feca8d 100644
--- a/crates/swc_ecma_transforms/tests/es2015_function_name.rs
+++ b/crates/swc_ecma_transforms/tests/es2015_function_name.rs
@@ -57,7 +57,7 @@ test!(
     r#"number = function (x) {
   return x;
 };"#,
-    r#"number = function number(x) {
+    r#"number = function number1(x) {
   return x;
 };"#
 );