Skip to content

Commit dba78a0

Browse files
authoredMay 17, 2023
fix(es/compat): Mark reserved function names private (#7298)
1 parent c520e74 commit dba78a0

20 files changed

+115
-96
lines changed
 

‎crates/swc/tests/fixture/issues-1xxx/1681/es3/output/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _templateObject1() {
1414
], [
1515
"a\\nb\\nc\\n"
1616
]);
17-
_templateObject1 = function _templateObject1() {
17+
_templateObject1 = function _templateObject() {
1818
return data;
1919
};
2020
return data;

‎crates/swc/tests/fixture/issues-1xxx/1681/es5/output/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _templateObject1() {
1414
], [
1515
"a\\nb\\nc\\n"
1616
]);
17-
_templateObject1 = function _templateObject1() {
17+
_templateObject1 = function _templateObject() {
1818
return data;
1919
};
2020
return data;

‎crates/swc/tests/fixture/issues-1xxx/1742/case1/output/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function _templateObject1() {
1717
var data = _tagged_template_literal([
1818
"tagged template"
1919
]);
20-
_templateObject1 = function _templateObject1() {
20+
_templateObject1 = function _templateObject() {
2121
return data;
2222
};
2323
return data;

‎crates/swc/tests/fixture/issues-2xxx/2468/1/output/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function _templateObject1() {
1212
var data = _tagged_template_literal([
1313
"2"
1414
]);
15-
_templateObject1 = function _templateObject1() {
15+
_templateObject1 = function _templateObject() {
1616
return data;
1717
};
1818
return data;

‎crates/swc/tests/fixture/issues-5xxx/5068/1/output/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function _templateObject1() {
1212
var data = _tagged_template_literal([
1313
"\n position: absolute;\n"
1414
]);
15-
_templateObject1 = function _templateObject1() {
15+
_templateObject1 = function _templateObject() {
1616
return data;
1717
};
1818
return data;

‎crates/swc/tests/fixture/issues-5xxx/5556/output/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
22
var app;
33
var ctx;
4-
x = function x() {
4+
x = function x1() {
55
var y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(app) {
66
return {
77
schedule: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "ecmascript",
5+
"jsx": false
6+
},
7+
"target": "es5"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var bmRnd;
2+
function a() {
3+
bmRnd = function () {};
4+
}
5+
eval('');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var bmRnd;
2+
function a() {
3+
bmRnd = function bmRnd1() {};
4+
}
5+
eval("");

‎crates/swc/tests/tsc-references/asOperator3.1.normal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _templateObject1() {
1414
var data = _tagged_template_literal([
1515
"Hello"
1616
]);
17-
_templateObject1 = function _templateObject1() {
17+
_templateObject1 = function _templateObject() {
1818
return data;
1919
};
2020
return data;

‎crates/swc/tests/tsc-references/jsDeclarationsExportDoubleAssignmentInClosure.1.normal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//// [index.js]
22
// @ts-nocheck
33
function foo() {
4-
module.exports = exports = function exports(o) {
4+
module.exports = exports = function exports1(o) {
55
return o == null ? create(base) : defineProperties(Object(o), descriptors);
66
};
77
var m = function m() {

‎crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _templateObject1() {
1414
var data = _tagged_template_literal([
1515
""
1616
]);
17-
_templateObject1 = function _templateObject1() {
17+
_templateObject1 = function _templateObject() {
1818
return data;
1919
};
2020
return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
2424
"",
2525
""
2626
]);
27-
_templateObject2 = function _templateObject2() {
27+
_templateObject2 = function _templateObject() {
2828
return data;
2929
};
3030
return data;
@@ -34,7 +34,7 @@ function _templateObject3() {
3434
"",
3535
""
3636
]);
37-
_templateObject3 = function _templateObject3() {
37+
_templateObject3 = function _templateObject() {
3838
return data;
3939
};
4040
return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
4444
"",
4545
""
4646
]);
47-
_templateObject4 = function _templateObject4() {
47+
_templateObject4 = function _templateObject() {
4848
return data;
4949
};
5050
return data;
@@ -54,7 +54,7 @@ function _templateObject5() {
5454
"",
5555
""
5656
]);
57-
_templateObject5 = function _templateObject5() {
57+
_templateObject5 = function _templateObject() {
5858
return data;
5959
};
6060
return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
6464
"",
6565
""
6666
]);
67-
_templateObject6 = function _templateObject6() {
67+
_templateObject6 = function _templateObject() {
6868
return data;
6969
};
7070
return data;
@@ -74,7 +74,7 @@ function _templateObject7() {
7474
"",
7575
""
7676
]);
77-
_templateObject7 = function _templateObject7() {
77+
_templateObject7 = function _templateObject() {
7878
return data;
7979
};
8080
return data;
@@ -84,7 +84,7 @@ function _templateObject8() {
8484
"",
8585
""
8686
]);
87-
_templateObject8 = function _templateObject8() {
87+
_templateObject8 = function _templateObject() {
8888
return data;
8989
};
9090
return data;
@@ -95,7 +95,7 @@ function _templateObject9() {
9595
"",
9696
""
9797
]);
98-
_templateObject9 = function _templateObject9() {
98+
_templateObject9 = function _templateObject() {
9999
return data;
100100
};
101101
return data;
@@ -106,7 +106,7 @@ function _templateObject10() {
106106
"",
107107
""
108108
]);
109-
_templateObject10 = function _templateObject10() {
109+
_templateObject10 = function _templateObject() {
110110
return data;
111111
};
112112
return data;
@@ -117,7 +117,7 @@ function _templateObject11() {
117117
"",
118118
""
119119
]);
120-
_templateObject11 = function _templateObject11() {
120+
_templateObject11 = function _templateObject() {
121121
return data;
122122
};
123123
return data;
@@ -128,7 +128,7 @@ function _templateObject12() {
128128
" ",
129129
""
130130
]);
131-
_templateObject12 = function _templateObject12() {
131+
_templateObject12 = function _templateObject() {
132132
return data;
133133
};
134134
return data;
@@ -139,7 +139,7 @@ function _templateObject13() {
139139
"",
140140
""
141141
]);
142-
_templateObject13 = function _templateObject13() {
142+
_templateObject13 = function _templateObject() {
143143
return data;
144144
};
145145
return data;
@@ -150,7 +150,7 @@ function _templateObject14() {
150150
"",
151151
""
152152
]);
153-
_templateObject14 = function _templateObject14() {
153+
_templateObject14 = function _templateObject() {
154154
return data;
155155
};
156156
return data;
@@ -162,7 +162,7 @@ function _templateObject15() {
162162
"",
163163
""
164164
]);
165-
_templateObject15 = function _templateObject15() {
165+
_templateObject15 = function _templateObject() {
166166
return data;
167167
};
168168
return data;
@@ -174,7 +174,7 @@ function _templateObject16() {
174174
"",
175175
""
176176
]);
177-
_templateObject16 = function _templateObject16() {
177+
_templateObject16 = function _templateObject() {
178178
return data;
179179
};
180180
return data;
@@ -186,7 +186,7 @@ function _templateObject17() {
186186
"",
187187
""
188188
]);
189-
_templateObject17 = function _templateObject17() {
189+
_templateObject17 = function _templateObject() {
190190
return data;
191191
};
192192
return data;
@@ -198,7 +198,7 @@ function _templateObject18() {
198198
"",
199199
""
200200
]);
201-
_templateObject18 = function _templateObject18() {
201+
_templateObject18 = function _templateObject() {
202202
return data;
203203
};
204204
return data;
@@ -210,7 +210,7 @@ function _templateObject19() {
210210
"",
211211
""
212212
]);
213-
_templateObject19 = function _templateObject19() {
213+
_templateObject19 = function _templateObject() {
214214
return data;
215215
};
216216
return data;
@@ -222,7 +222,7 @@ function _templateObject20() {
222222
"",
223223
""
224224
]);
225-
_templateObject20 = function _templateObject20() {
225+
_templateObject20 = function _templateObject() {
226226
return data;
227227
};
228228
return data;
@@ -232,7 +232,7 @@ function _templateObject21() {
232232
"",
233233
""
234234
]);
235-
_templateObject21 = function _templateObject21() {
235+
_templateObject21 = function _templateObject() {
236236
return data;
237237
};
238238
return data;
@@ -244,7 +244,7 @@ function _templateObject22() {
244244
"",
245245
""
246246
]);
247-
_templateObject22 = function _templateObject22() {
247+
_templateObject22 = function _templateObject() {
248248
return data;
249249
};
250250
return data;
@@ -256,7 +256,7 @@ function _templateObject23() {
256256
"",
257257
""
258258
]);
259-
_templateObject23 = function _templateObject23() {
259+
_templateObject23 = function _templateObject() {
260260
return data;
261261
};
262262
return data;
@@ -268,7 +268,7 @@ function _templateObject24() {
268268
"",
269269
""
270270
]);
271-
_templateObject24 = function _templateObject24() {
271+
_templateObject24 = function _templateObject() {
272272
return data;
273273
};
274274
return data;
@@ -280,7 +280,7 @@ function _templateObject25() {
280280
"",
281281
""
282282
]);
283-
_templateObject25 = function _templateObject25() {
283+
_templateObject25 = function _templateObject() {
284284
return data;
285285
};
286286
return data;
@@ -292,7 +292,7 @@ function _templateObject26() {
292292
"",
293293
""
294294
]);
295-
_templateObject26 = function _templateObject26() {
295+
_templateObject26 = function _templateObject() {
296296
return data;
297297
};
298298
return data;
@@ -304,7 +304,7 @@ function _templateObject27() {
304304
"",
305305
""
306306
]);
307-
_templateObject27 = function _templateObject27() {
307+
_templateObject27 = function _templateObject() {
308308
return data;
309309
};
310310
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithIncompatibleTypedTags.1.normal.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _templateObject1() {
1515
"def",
1616
"ghi"
1717
]);
18-
_templateObject1 = function _templateObject1() {
18+
_templateObject1 = function _templateObject() {
1919
return data;
2020
};
2121
return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
2424
var data = _tagged_template_literal([
2525
"abc"
2626
]);
27-
_templateObject2 = function _templateObject2() {
27+
_templateObject2 = function _templateObject() {
2828
return data;
2929
};
3030
return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
3535
"def",
3636
"ghi"
3737
]);
38-
_templateObject3 = function _templateObject3() {
38+
_templateObject3 = function _templateObject() {
3939
return data;
4040
};
4141
return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
4444
var data = _tagged_template_literal([
4545
"abc"
4646
]);
47-
_templateObject4 = function _templateObject4() {
47+
_templateObject4 = function _templateObject() {
4848
return data;
4949
};
5050
return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
5555
"def",
5656
"ghi"
5757
]);
58-
_templateObject5 = function _templateObject5() {
58+
_templateObject5 = function _templateObject() {
5959
return data;
6060
};
6161
return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
6464
var data = _tagged_template_literal([
6565
"abc"
6666
]);
67-
_templateObject6 = function _templateObject6() {
67+
_templateObject6 = function _templateObject() {
6868
return data;
6969
};
7070
return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
7575
"def",
7676
"ghi"
7777
]);
78-
_templateObject7 = function _templateObject7() {
78+
_templateObject7 = function _templateObject() {
7979
return data;
8080
};
8181
return data;
@@ -86,7 +86,7 @@ function _templateObject8() {
8686
"def",
8787
"ghi"
8888
]);
89-
_templateObject8 = function _templateObject8() {
89+
_templateObject8 = function _templateObject() {
9090
return data;
9191
};
9292
return data;
@@ -97,7 +97,7 @@ function _templateObject9() {
9797
"def",
9898
"ghi"
9999
]);
100-
_templateObject9 = function _templateObject9() {
100+
_templateObject9 = function _templateObject() {
101101
return data;
102102
};
103103
return data;
@@ -108,7 +108,7 @@ function _templateObject10() {
108108
"def",
109109
"ghi"
110110
]);
111-
_templateObject10 = function _templateObject10() {
111+
_templateObject10 = function _templateObject() {
112112
return data;
113113
};
114114
return data;
@@ -119,7 +119,7 @@ function _templateObject11() {
119119
"def",
120120
"ghi"
121121
]);
122-
_templateObject11 = function _templateObject11() {
122+
_templateObject11 = function _templateObject() {
123123
return data;
124124
};
125125
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution1.1.normal.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _templateObject1() {
1414
"",
1515
""
1616
]);
17-
_templateObject1 = function _templateObject1() {
17+
_templateObject1 = function _templateObject() {
1818
return data;
1919
};
2020
return data;
@@ -25,7 +25,7 @@ function _templateObject2() {
2525
"",
2626
""
2727
]);
28-
_templateObject2 = function _templateObject2() {
28+
_templateObject2 = function _templateObject() {
2929
return data;
3030
};
3131
return data;
@@ -36,7 +36,7 @@ function _templateObject3() {
3636
"",
3737
""
3838
]);
39-
_templateObject3 = function _templateObject3() {
39+
_templateObject3 = function _templateObject() {
4040
return data;
4141
};
4242
return data;
@@ -47,7 +47,7 @@ function _templateObject4() {
4747
"",
4848
""
4949
]);
50-
_templateObject4 = function _templateObject4() {
50+
_templateObject4 = function _templateObject() {
5151
return data;
5252
};
5353
return data;
@@ -59,7 +59,7 @@ function _templateObject5() {
5959
"",
6060
""
6161
]);
62-
_templateObject5 = function _templateObject5() {
62+
_templateObject5 = function _templateObject() {
6363
return data;
6464
};
6565
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution2.1.normal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _templateObject1() {
1515
"",
1616
""
1717
]);
18-
_templateObject1 = function _templateObject1() {
18+
_templateObject1 = function _templateObject() {
1919
return data;
2020
};
2121
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function _templateObject1() {
1616
"",
1717
""
1818
]);
19-
_templateObject1 = function _templateObject1() {
19+
_templateObject1 = function _templateObject() {
2020
return data;
2121
};
2222
return data;
@@ -27,7 +27,7 @@ function _templateObject2() {
2727
"",
2828
""
2929
]);
30-
_templateObject2 = function _templateObject2() {
30+
_templateObject2 = function _templateObject() {
3131
return data;
3232
};
3333
return data;
@@ -38,7 +38,7 @@ function _templateObject3() {
3838
"",
3939
""
4040
]);
41-
_templateObject3 = function _templateObject3() {
41+
_templateObject3 = function _templateObject() {
4242
return data;
4343
};
4444
return data;
@@ -49,7 +49,7 @@ function _templateObject4() {
4949
"",
5050
""
5151
]);
52-
_templateObject4 = function _templateObject4() {
52+
_templateObject4 = function _templateObject() {
5353
return data;
5454
};
5555
return data;
@@ -60,7 +60,7 @@ function _templateObject5() {
6060
"",
6161
""
6262
]);
63-
_templateObject5 = function _templateObject5() {
63+
_templateObject5 = function _templateObject() {
6464
return data;
6565
};
6666
return data;
@@ -70,7 +70,7 @@ function _templateObject6() {
7070
"",
7171
""
7272
]);
73-
_templateObject6 = function _templateObject6() {
73+
_templateObject6 = function _templateObject() {
7474
return data;
7575
};
7676
return data;
@@ -82,7 +82,7 @@ function _templateObject7() {
8282
"",
8383
""
8484
]);
85-
_templateObject7 = function _templateObject7() {
85+
_templateObject7 = function _templateObject() {
8686
return data;
8787
};
8888
return data;
@@ -94,7 +94,7 @@ function _templateObject8() {
9494
"",
9595
""
9696
]);
97-
_templateObject8 = function _templateObject8() {
97+
_templateObject8 = function _templateObject() {
9898
return data;
9999
};
100100
return data;
@@ -104,7 +104,7 @@ function _templateObject9() {
104104
"",
105105
""
106106
]);
107-
_templateObject9 = function _templateObject9() {
107+
_templateObject9 = function _templateObject() {
108108
return data;
109109
};
110110
return data;
@@ -116,7 +116,7 @@ function _templateObject10() {
116116
"",
117117
""
118118
]);
119-
_templateObject10 = function _templateObject10() {
119+
_templateObject10 = function _templateObject() {
120120
return data;
121121
};
122122
return data;
@@ -128,7 +128,7 @@ function _templateObject11() {
128128
"",
129129
""
130130
]);
131-
_templateObject11 = function _templateObject11() {
131+
_templateObject11 = function _templateObject() {
132132
return data;
133133
};
134134
return data;
@@ -137,7 +137,7 @@ function _templateObject12() {
137137
var data = _tagged_template_literal([
138138
""
139139
]);
140-
_templateObject12 = function _templateObject12() {
140+
_templateObject12 = function _templateObject() {
141141
return data;
142142
};
143143
return data;
@@ -148,7 +148,7 @@ function _templateObject13() {
148148
"",
149149
""
150150
]);
151-
_templateObject13 = function _templateObject13() {
151+
_templateObject13 = function _templateObject() {
152152
return data;
153153
};
154154
return data;
@@ -159,7 +159,7 @@ function _templateObject14() {
159159
"",
160160
""
161161
]);
162-
_templateObject14 = function _templateObject14() {
162+
_templateObject14 = function _templateObject() {
163163
return data;
164164
};
165165
return data;
@@ -170,7 +170,7 @@ function _templateObject15() {
170170
"",
171171
""
172172
]);
173-
_templateObject15 = function _templateObject15() {
173+
_templateObject15 = function _templateObject() {
174174
return data;
175175
};
176176
return data;
@@ -181,7 +181,7 @@ function _templateObject16() {
181181
"",
182182
""
183183
]);
184-
_templateObject16 = function _templateObject16() {
184+
_templateObject16 = function _templateObject() {
185185
return data;
186186
};
187187
return data;
@@ -192,7 +192,7 @@ function _templateObject17() {
192192
"",
193193
""
194194
]);
195-
_templateObject17 = function _templateObject17() {
195+
_templateObject17 = function _templateObject() {
196196
return data;
197197
};
198198
return data;
@@ -203,7 +203,7 @@ function _templateObject18() {
203203
"",
204204
""
205205
]);
206-
_templateObject18 = function _templateObject18() {
206+
_templateObject18 = function _templateObject() {
207207
return data;
208208
};
209209
return data;
@@ -214,7 +214,7 @@ function _templateObject19() {
214214
"",
215215
""
216216
]);
217-
_templateObject19 = function _templateObject19() {
217+
_templateObject19 = function _templateObject() {
218218
return data;
219219
};
220220
return data;
@@ -224,7 +224,7 @@ function _templateObject20() {
224224
"",
225225
""
226226
]);
227-
_templateObject20 = function _templateObject20() {
227+
_templateObject20 = function _templateObject() {
228228
return data;
229229
};
230230
return data;
@@ -234,7 +234,7 @@ function _templateObject21() {
234234
"",
235235
""
236236
]);
237-
_templateObject21 = function _templateObject21() {
237+
_templateObject21 = function _templateObject() {
238238
return data;
239239
};
240240
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithTagsTypedAsAny.1.normal.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _templateObject1() {
1515
"def",
1616
"ghi"
1717
]);
18-
_templateObject1 = function _templateObject1() {
18+
_templateObject1 = function _templateObject() {
1919
return data;
2020
};
2121
return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
2424
var data = _tagged_template_literal([
2525
"abc"
2626
]);
27-
_templateObject2 = function _templateObject2() {
27+
_templateObject2 = function _templateObject() {
2828
return data;
2929
};
3030
return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
3535
"def",
3636
"ghi"
3737
]);
38-
_templateObject3 = function _templateObject3() {
38+
_templateObject3 = function _templateObject() {
3939
return data;
4040
};
4141
return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
4444
var data = _tagged_template_literal([
4545
"abc"
4646
]);
47-
_templateObject4 = function _templateObject4() {
47+
_templateObject4 = function _templateObject() {
4848
return data;
4949
};
5050
return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
5555
"def",
5656
"ghi"
5757
]);
58-
_templateObject5 = function _templateObject5() {
58+
_templateObject5 = function _templateObject() {
5959
return data;
6060
};
6161
return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
6464
var data = _tagged_template_literal([
6565
"abc"
6666
]);
67-
_templateObject6 = function _templateObject6() {
67+
_templateObject6 = function _templateObject() {
6868
return data;
6969
};
7070
return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
7575
"def",
7676
"ghi"
7777
]);
78-
_templateObject7 = function _templateObject7() {
78+
_templateObject7 = function _templateObject() {
7979
return data;
8080
};
8181
return data;
@@ -84,7 +84,7 @@ function _templateObject8() {
8484
var data = _tagged_template_literal([
8585
"abc"
8686
]);
87-
_templateObject8 = function _templateObject8() {
87+
_templateObject8 = function _templateObject() {
8888
return data;
8989
};
9090
return data;
@@ -95,7 +95,7 @@ function _templateObject9() {
9595
"def",
9696
"ghi"
9797
]);
98-
_templateObject9 = function _templateObject9() {
98+
_templateObject9 = function _templateObject() {
9999
return data;
100100
};
101101
return data;
@@ -106,7 +106,7 @@ function _templateObject10() {
106106
"def",
107107
"ghi"
108108
]);
109-
_templateObject10 = function _templateObject10() {
109+
_templateObject10 = function _templateObject() {
110110
return data;
111111
};
112112
return data;
@@ -117,7 +117,7 @@ function _templateObject11() {
117117
"def",
118118
"ghi"
119119
]);
120-
_templateObject11 = function _templateObject11() {
120+
_templateObject11 = function _templateObject() {
121121
return data;
122122
};
123123
return data;

‎crates/swc/tests/tsc-references/taggedTemplateStringsWithTypedTags.1.normal.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _templateObject1() {
1515
"def",
1616
"ghi"
1717
]);
18-
_templateObject1 = function _templateObject1() {
18+
_templateObject1 = function _templateObject() {
1919
return data;
2020
};
2121
return data;
@@ -24,7 +24,7 @@ function _templateObject2() {
2424
var data = _tagged_template_literal([
2525
"abc"
2626
]);
27-
_templateObject2 = function _templateObject2() {
27+
_templateObject2 = function _templateObject() {
2828
return data;
2929
};
3030
return data;
@@ -35,7 +35,7 @@ function _templateObject3() {
3535
"def",
3636
"ghi"
3737
]);
38-
_templateObject3 = function _templateObject3() {
38+
_templateObject3 = function _templateObject() {
3939
return data;
4040
};
4141
return data;
@@ -44,7 +44,7 @@ function _templateObject4() {
4444
var data = _tagged_template_literal([
4545
"abc"
4646
]);
47-
_templateObject4 = function _templateObject4() {
47+
_templateObject4 = function _templateObject() {
4848
return data;
4949
};
5050
return data;
@@ -55,7 +55,7 @@ function _templateObject5() {
5555
"def",
5656
"ghi"
5757
]);
58-
_templateObject5 = function _templateObject5() {
58+
_templateObject5 = function _templateObject() {
5959
return data;
6060
};
6161
return data;
@@ -64,7 +64,7 @@ function _templateObject6() {
6464
var data = _tagged_template_literal([
6565
"abc"
6666
]);
67-
_templateObject6 = function _templateObject6() {
67+
_templateObject6 = function _templateObject() {
6868
return data;
6969
};
7070
return data;
@@ -75,7 +75,7 @@ function _templateObject7() {
7575
"def",
7676
"ghi"
7777
]);
78-
_templateObject7 = function _templateObject7() {
78+
_templateObject7 = function _templateObject() {
7979
return data;
8080
};
8181
return data;
@@ -86,7 +86,7 @@ function _templateObject8() {
8686
"def",
8787
"ghi"
8888
]);
89-
_templateObject8 = function _templateObject8() {
89+
_templateObject8 = function _templateObject() {
9090
return data;
9191
};
9292
return data;
@@ -97,7 +97,7 @@ function _templateObject9() {
9797
"def",
9898
"ghi"
9999
]);
100-
_templateObject9 = function _templateObject9() {
100+
_templateObject9 = function _templateObject() {
101101
return data;
102102
};
103103
return data;

‎crates/swc_ecma_transforms/tests/es2015_function_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ test!(
5757
r#"number = function (x) {
5858
return x;
5959
};"#,
60-
r#"number = function number(x) {
60+
r#"number = function number1(x) {
6161
return x;
6262
};"#
6363
);

‎crates/swc_ecma_transforms_compat/src/es2015/function_name.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use swc_common::util::take::Take;
1+
use swc_common::{util::take::Take, DUMMY_SP};
22
use swc_ecma_ast::*;
33
use swc_ecma_transforms_base::perf::Parallel;
44
use swc_ecma_utils::{private_ident, IdentUsageFinder};
@@ -118,7 +118,7 @@ macro_rules! impl_for {
118118
// self.name = Some(name);
119119
node.ident = None;
120120
} else {
121-
node.ident = Some(name);
121+
node.ident = Some(private_ident!(DUMMY_SP, name.sym));
122122
}
123123
}
124124
}

1 commit comments

Comments
 (1)

github-actions[bot] commented on May 17, 2023

@github-actions[bot]

Benchmark

Benchmark suite Current: dba78a0 Previous: 95291f2 Ratio
es/full/bugs-1 250780 ns/iter (± 2416) 300372 ns/iter (± 15865) 0.83
es/full/minify/libraries/antd 1186587416 ns/iter (± 6591651) 1607656803 ns/iter (± 29906593) 0.74
es/full/minify/libraries/d3 238106401 ns/iter (± 2892611) 305474597 ns/iter (± 8554642) 0.78
es/full/minify/libraries/echarts 935935043 ns/iter (± 5568815) 1242908221 ns/iter (± 20574337) 0.75
es/full/minify/libraries/jquery 76138256 ns/iter (± 135935) 93908818 ns/iter (± 1533890) 0.81
es/full/minify/libraries/lodash 85857897 ns/iter (± 102939) 108314285 ns/iter (± 882015) 0.79
es/full/minify/libraries/moment 44439532 ns/iter (± 128917) 53210694 ns/iter (± 510776) 0.84
es/full/minify/libraries/react 16201438 ns/iter (± 45997) 19179433 ns/iter (± 139842) 0.84
es/full/minify/libraries/terser 195197782 ns/iter (± 547638) 246777411 ns/iter (± 5445640) 0.79
es/full/minify/libraries/three 333687914 ns/iter (± 1249854) 429449329 ns/iter (± 5470462) 0.78
es/full/minify/libraries/typescript 2323670505 ns/iter (± 15308592) 2978491848 ns/iter (± 33978620) 0.78
es/full/minify/libraries/victory 490304937 ns/iter (± 2967073) 686487445 ns/iter (± 12506154) 0.71
es/full/minify/libraries/vue 105655149 ns/iter (± 385026) 134991013 ns/iter (± 2856332) 0.78
es/full/codegen/es3 29979 ns/iter (± 311) 34010 ns/iter (± 71) 0.88
es/full/codegen/es5 30333 ns/iter (± 238) 34093 ns/iter (± 67) 0.89
es/full/codegen/es2015 30297 ns/iter (± 227) 34132 ns/iter (± 57) 0.89
es/full/codegen/es2016 30366 ns/iter (± 1280) 34096 ns/iter (± 51) 0.89
es/full/codegen/es2017 30354 ns/iter (± 173) 34093 ns/iter (± 39) 0.89
es/full/codegen/es2018 30465 ns/iter (± 303) 34091 ns/iter (± 42) 0.89
es/full/codegen/es2019 30664 ns/iter (± 139) 34083 ns/iter (± 66) 0.90
es/full/codegen/es2020 30095 ns/iter (± 286) 34112 ns/iter (± 36) 0.88
es/full/all/es3 154882112 ns/iter (± 1086660) 178296249 ns/iter (± 2565170) 0.87
es/full/all/es5 148072879 ns/iter (± 517316) 173827873 ns/iter (± 3696402) 0.85
es/full/all/es2015 110324625 ns/iter (± 568788) 136504400 ns/iter (± 1244268) 0.81
es/full/all/es2016 109131895 ns/iter (± 684921) 134920008 ns/iter (± 990261) 0.81
es/full/all/es2017 108446109 ns/iter (± 762463) 133422481 ns/iter (± 2336904) 0.81
es/full/all/es2018 106928885 ns/iter (± 395971) 128235249 ns/iter (± 2884478) 0.83
es/full/all/es2019 105842298 ns/iter (± 580817) 127422741 ns/iter (± 1684739) 0.83
es/full/all/es2020 100507575 ns/iter (± 899204) 119173128 ns/iter (± 854386) 0.84
es/full/parser 448159 ns/iter (± 7225) 520540 ns/iter (± 8684) 0.86
es/full/base/fixer 17604 ns/iter (± 254) 23043 ns/iter (± 33) 0.76
es/full/base/resolver_and_hygiene 72809 ns/iter (± 957) 85402 ns/iter (± 126) 0.85
serialization of serde 111 ns/iter (± 1) 123 ns/iter (± 0) 0.90
css/minify/libraries/bootstrap 23043505 ns/iter (± 179547) 27843022 ns/iter (± 227854) 0.83
css/visitor/compare/clone 1625181 ns/iter (± 16797) 2143202 ns/iter (± 10377) 0.76
css/visitor/compare/visit_mut_span 1738679 ns/iter (± 18622) 2348216 ns/iter (± 18707) 0.74
css/visitor/compare/visit_mut_span_panic 1785015 ns/iter (± 23356) 2398327 ns/iter (± 9192) 0.74
css/visitor/compare/fold_span 2443691 ns/iter (± 29818) 3111395 ns/iter (± 36009) 0.79
css/visitor/compare/fold_span_panic 2721990 ns/iter (± 47848) 3293788 ns/iter (± 17531) 0.83
css/lexer/bootstrap_5_1_3 4333245 ns/iter (± 70626) 5160854 ns/iter (± 35304) 0.84
css/lexer/foundation_6_7_4 3644167 ns/iter (± 23098) 4355314 ns/iter (± 3117) 0.84
css/lexer/tailwind_3_1_1 694204 ns/iter (± 8030) 826250 ns/iter (± 202) 0.84
css/parser/bootstrap_5_1_3 17899204 ns/iter (± 208082) 21476902 ns/iter (± 239734) 0.83
css/parser/foundation_6_7_4 14015496 ns/iter (± 152136) 17010750 ns/iter (± 106580) 0.82
css/parser/tailwind_3_1_1 2715648 ns/iter (± 25159) 3280021 ns/iter (± 3375) 0.83
es/codegen/colors 720735 ns/iter (± 400186) 733562 ns/iter (± 393848) 0.98
es/codegen/large 2978188 ns/iter (± 1582528) 3184667 ns/iter (± 1666200) 0.94
es/codegen/with-parser/colors 43036 ns/iter (± 493) 49842 ns/iter (± 391) 0.86
es/codegen/with-parser/large 457621 ns/iter (± 4430) 519487 ns/iter (± 1003) 0.88
es/minify/libraries/antd 1019645661 ns/iter (± 10090561) 1390458358 ns/iter (± 17652128) 0.73
es/minify/libraries/d3 209429344 ns/iter (± 1485753) 256313635 ns/iter (± 1901081) 0.82
es/minify/libraries/echarts 812126233 ns/iter (± 6284240) 1074681374 ns/iter (± 16235319) 0.76
es/minify/libraries/jquery 68370999 ns/iter (± 459371) 81439011 ns/iter (± 677820) 0.84
es/minify/libraries/lodash 78311987 ns/iter (± 225648) 98017556 ns/iter (± 1268992) 0.80
es/minify/libraries/moment 39631553 ns/iter (± 250531) 46912212 ns/iter (± 659549) 0.84
es/minify/libraries/react 14718858 ns/iter (± 133506) 17305689 ns/iter (± 112624) 0.85
es/minify/libraries/terser 171365519 ns/iter (± 1022428) 216507810 ns/iter (± 2959283) 0.79
es/minify/libraries/three 285746385 ns/iter (± 1812284) 374473140 ns/iter (± 4357368) 0.76
es/minify/libraries/typescript 2029194872 ns/iter (± 7339351) 2553534214 ns/iter (± 12977823) 0.79
es/minify/libraries/victory 420005071 ns/iter (± 1515336) 619028377 ns/iter (± 13926611) 0.68
es/minify/libraries/vue 96719073 ns/iter (± 417029) 121725023 ns/iter (± 2627985) 0.79
es/visitor/compare/clone 1961188 ns/iter (± 24360) 2326060 ns/iter (± 4454) 0.84
es/visitor/compare/visit_mut_span 2278363 ns/iter (± 25452) 2676466 ns/iter (± 5588) 0.85
es/visitor/compare/visit_mut_span_panic 2323046 ns/iter (± 33282) 2740002 ns/iter (± 10825) 0.85
es/visitor/compare/fold_span 3304067 ns/iter (± 31946) 3802232 ns/iter (± 6362) 0.87
es/visitor/compare/fold_span_panic 3540111 ns/iter (± 20806) 3941123 ns/iter (± 14368) 0.90
es/lexer/colors 11500 ns/iter (± 56) 13068 ns/iter (± 93) 0.88
es/lexer/angular 5599450 ns/iter (± 64804) 6408931 ns/iter (± 6318) 0.87
es/lexer/backbone 711363 ns/iter (± 11194) 773649 ns/iter (± 1110) 0.92
es/lexer/jquery 3977385 ns/iter (± 52529) 4399910 ns/iter (± 3491) 0.90
es/lexer/jquery mobile 6066474 ns/iter (± 48828) 6843187 ns/iter (± 3172) 0.89
es/lexer/mootools 3152292 ns/iter (± 16661) 3451827 ns/iter (± 5162) 0.91
es/lexer/underscore 581379 ns/iter (± 4405) 642949 ns/iter (± 324) 0.90
es/lexer/three 19133024 ns/iter (± 286402) 20903020 ns/iter (± 13949) 0.92
es/lexer/yui 3426125 ns/iter (± 33493) 3866684 ns/iter (± 699) 0.89
es/parser/colors 25079 ns/iter (± 320) 28577 ns/iter (± 60) 0.88
es/parser/angular 12652332 ns/iter (± 201870) 15302344 ns/iter (± 189462) 0.83
es/parser/backbone 1886019 ns/iter (± 30961) 2143096 ns/iter (± 8830) 0.88
es/parser/jquery 10514005 ns/iter (± 42292) 11707780 ns/iter (± 221967) 0.90
es/parser/jquery mobile 16142335 ns/iter (± 28845) 19297512 ns/iter (± 175638) 0.84
es/parser/mootools 8038070 ns/iter (± 26346) 8917587 ns/iter (± 52966) 0.90
es/parser/underscore 1647044 ns/iter (± 28704) 1815148 ns/iter (± 10565) 0.91
es/parser/three 43240229 ns/iter (± 672564) 54792396 ns/iter (± 264727) 0.79
es/parser/yui 7781733 ns/iter (± 114693) 9171261 ns/iter (± 81108) 0.85
es/preset-env/usage/builtin_type 147076 ns/iter (± 39774) 141849 ns/iter (± 35120) 1.04
es/preset-env/usage/property 14968 ns/iter (± 235) 19814 ns/iter (± 146) 0.76
es/resolver/typescript 88805964 ns/iter (± 1332868) 114519896 ns/iter (± 1718059) 0.78
es/fixer/typescript 61987034 ns/iter (± 1084878) 81142762 ns/iter (± 2638053) 0.76
es/hygiene/typescript 127700864 ns/iter (± 944972) 175749243 ns/iter (± 2274084) 0.73
es/resolver_with_hygiene/typescript 228874438 ns/iter (± 1628279) 322843901 ns/iter (± 3604413) 0.71
es/visitor/base-perf/module_clone 59296 ns/iter (± 473) 81163 ns/iter (± 305) 0.73
es/visitor/base-perf/fold_empty 63202 ns/iter (± 562) 91086 ns/iter (± 589) 0.69
es/visitor/base-perf/fold_noop_impl_all 62971 ns/iter (± 598) 91177 ns/iter (± 326) 0.69
es/visitor/base-perf/fold_noop_impl_vec 63530 ns/iter (± 280) 91224 ns/iter (± 588) 0.70
es/visitor/base-perf/boxing_boxed_clone 52 ns/iter (± 0) 56 ns/iter (± 0) 0.93
es/visitor/base-perf/boxing_unboxed_clone 37 ns/iter (± 0) 41 ns/iter (± 0) 0.90
es/visitor/base-perf/boxing_boxed 108 ns/iter (± 0) 103 ns/iter (± 0) 1.05
es/visitor/base-perf/boxing_unboxed 76 ns/iter (± 0) 79 ns/iter (± 0) 0.96
es/visitor/base-perf/visit_empty 0 ns/iter (± 0)
es/visitor/base-perf/visit_contains_this 2634 ns/iter (± 9) 3479 ns/iter (± 45) 0.76
es/base/parallel/resolver/typescript 4033823585 ns/iter (± 310187349) 6330100760 ns/iter (± 478251637) 0.64
es/base/parallel/hygiene/typescript 1424769325 ns/iter (± 30166522) 2044163969 ns/iter (± 26678699) 0.70
misc/visitors/time-complexity/time 5 101 ns/iter (± 0) 110 ns/iter (± 0) 0.92
misc/visitors/time-complexity/time 10 295 ns/iter (± 0) 377 ns/iter (± 2) 0.78
misc/visitors/time-complexity/time 15 718 ns/iter (± 2) 733 ns/iter (± 15) 0.98
misc/visitors/time-complexity/time 20 1049 ns/iter (± 52) 1343 ns/iter (± 0) 0.78
misc/visitors/time-complexity/time 40 3756 ns/iter (± 11) 7017 ns/iter (± 3) 0.54
misc/visitors/time-complexity/time 60 8684 ns/iter (± 28) 17843 ns/iter (± 49) 0.49
es/full-target/es2016 226668 ns/iter (± 686) 253607 ns/iter (± 562) 0.89
es/full-target/es2017 217348 ns/iter (± 794) 246240 ns/iter (± 365) 0.88
es/full-target/es2018 205154 ns/iter (± 624) 235008 ns/iter (± 395) 0.87
es2020_nullish_coalescing 68208 ns/iter (± 413) 93452 ns/iter (± 233) 0.73
es2020_optional_chaining 94762 ns/iter (± 672) 124042 ns/iter (± 266) 0.76
es2022_class_properties 116726 ns/iter (± 300) 148610 ns/iter (± 219) 0.79
es2018_object_rest_spread 71568 ns/iter (± 364) 95811 ns/iter (± 790) 0.75
es2019_optional_catch_binding 61476 ns/iter (± 351) 84975 ns/iter (± 165) 0.72
es2017_async_to_generator 62685 ns/iter (± 213) 85726 ns/iter (± 188) 0.73
es2016_exponentiation 66460 ns/iter (± 199) 90269 ns/iter (± 252) 0.74
es2015_arrow 67545 ns/iter (± 186) 93803 ns/iter (± 228) 0.72
es2015_block_scoped_fn 66652 ns/iter (± 201) 91674 ns/iter (± 238) 0.73
es2015_block_scoping 118028 ns/iter (± 374) 169990 ns/iter (± 328) 0.69

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.