Skip to content

Commit c4b8684

Browse files
committed
fix(es/minifier): use numeric literals for non-finite values
1 parent 2559d40 commit c4b8684

107 files changed

Lines changed: 938 additions & 764 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
swc: patch
3+
swc_core: patch
4+
swc_ecma_minifier: patch
5+
swc_ecma_transforms_optimization: patch
6+
swc_ecma_utils: patch
7+
---
8+
9+
fix(es/minifier): Use numeric literals for non-finite values during optimization.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
//// [computedPropertyNamesContextualType10_ES5.ts]
22
var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
4-
_define_property(_obj = {}, NaN, ""), _define_property(_obj, NaN, 0);
4+
_define_property(_obj = {}, 0 / 0, ""), _define_property(_obj, 0 / 0, 0);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//// [computedPropertyNamesContextualType2_ES5.ts]
22
var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
4-
_define_property(_obj = {}, NaN, function(y) {
4+
_define_property(_obj = {}, 0 / 0, function(y) {
55
return y.length;
6-
}), _define_property(_obj, NaN, function(y) {
6+
}), _define_property(_obj, 0 / 0, function(y) {
77
return y.length;
88
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//// [computedPropertyNamesContextualType3_ES5.ts]
22
var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
4-
_define_property(_obj = {}, NaN, function(y) {
4+
_define_property(_obj = {}, 0 / 0, function(y) {
55
return y.length;
6-
}), _define_property(_obj, NaN, function(y) {
6+
}), _define_property(_obj, 0 / 0, function(y) {
77
return y.length;
88
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
//// [computedPropertyNamesContextualType5_ES5.ts]
22
var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
4-
_define_property(_obj = {}, NaN, ""), _define_property(_obj, NaN, 0);
4+
_define_property(_obj = {}, 0 / 0, ""), _define_property(_obj, 0 / 0, 0);

crates/swc/tests/tsc-references/computedPropertyNamesContextualType6_ES5.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
44
foo((_define_property(_obj = {
55
p: "",
66
0: function() {}
7-
}, "hibye", !0), _define_property(_obj, 1, 0), _define_property(_obj, NaN, [
7+
}, "hibye", !0), _define_property(_obj, 1, 0), _define_property(_obj, 0 / 0, [
88
0
99
]), _obj));

crates/swc/tests/tsc-references/computedPropertyNamesContextualType6_ES6.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ foo({
44
0: ()=>{},
55
hibye: !0,
66
1: 0,
7-
[NaN]: [
7+
NaN: [
88
0
99
]
1010
});

crates/swc/tests/tsc-references/computedPropertyNamesContextualType7_ES5.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
44
foo((_define_property(_obj = {
55
0: function() {}
6-
}, "hibye", !0), _define_property(_obj, 1, 0), _define_property(_obj, NaN, [
6+
}, "hibye", !0), _define_property(_obj, 1, 0), _define_property(_obj, 0 / 0, [
77
0
88
]), _obj)), g({
99
p: ""

crates/swc/tests/tsc-references/computedPropertyNamesContextualType7_ES6.2.minified.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ foo({
33
0: ()=>{},
44
hibye: !0,
55
1: 0,
6-
[NaN]: [
6+
NaN: [
77
0
88
]
99
}), g({
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
//// [computedPropertyNamesContextualType9_ES5.ts]
22
var _obj;
33
import { _ as _define_property } from "@swc/helpers/_/_define_property";
4-
_define_property(_obj = {}, NaN, ""), _define_property(_obj, NaN, 0);
4+
_define_property(_obj = {}, 0 / 0, ""), _define_property(_obj, 0 / 0, 0);

0 commit comments

Comments
 (0)