Skip to content

Commit

Permalink
fix(es/minifier): Preserve classes with side effects in static fields (
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 authored Nov 24, 2022
1 parent 6fd9797 commit 8d906b4
Show file tree
Hide file tree
Showing 25 changed files with 612 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
//// [classStaticBlock15.ts]
console.log(void 0);
var _C__1;
class C {
static #_1 = 1;
static #_3 = 3;
static #_5 = 5;
static{}
static{}
static{}
static{}
static{}
static{}
}
console.log(_C__1);
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//// [classStaticBlock23.ts]
[
const nums = [
1,
2,
3
].map((n)=>Promise.resolve(n));
class C {
static{
for await (let nn of nums)console.log(nn);
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
//// [classStaticBlock5.ts]
super.a;
class B {
static a = 1;
static b = 2;
}
class C extends B {
static b = 3;
static c = super.a;
static{
this.b, super.b, super.a;
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
//// [classStaticBlockUseBeforeDef1.ts]
this.x;
class C {
static{
this.x = 1;
}
static y = this.x;
static{
this.z = this.y;
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
//// [classStaticBlockUseBeforeDef2.ts]
class C {
static{
this.x = 1;
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
//// [privateNameComputedPropertyName4.ts]
class C1 {
static #qux = 42;
bar() {}
}
class C2 {
static #qux = 42;
static bar() {}
}
class C3 {
static #qux = 42;
static bar = "test";
}
Loading

1 comment on commit 8d906b4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8d906b4 Previous: b3b5526 Ratio
es/full/bugs-1 339249 ns/iter (± 19114) 348064 ns/iter (± 21090) 0.97
es/full/minify/libraries/antd 1926569394 ns/iter (± 34703410) 1861224113 ns/iter (± 18958664) 1.04
es/full/minify/libraries/d3 435442912 ns/iter (± 7649321) 389988874 ns/iter (± 6870003) 1.12
es/full/minify/libraries/echarts 1624471008 ns/iter (± 28803665) 1577763775 ns/iter (± 16905140) 1.03
es/full/minify/libraries/jquery 102257399 ns/iter (± 8813358) 98646680 ns/iter (± 2204385) 1.04
es/full/minify/libraries/lodash 130135274 ns/iter (± 4286135) 116542380 ns/iter (± 1726326) 1.12
es/full/minify/libraries/moment 63941126 ns/iter (± 3293122) 59429737 ns/iter (± 2548244) 1.08
es/full/minify/libraries/react 21328940 ns/iter (± 1355804) 19875033 ns/iter (± 430279) 1.07
es/full/minify/libraries/terser 325367259 ns/iter (± 28015923) 295769946 ns/iter (± 4592453) 1.10
es/full/minify/libraries/three 578632415 ns/iter (± 18338390) 556747640 ns/iter (± 9272686) 1.04
es/full/minify/libraries/typescript 3437266357 ns/iter (± 47791599) 3380624220 ns/iter (± 30967521) 1.02
es/full/minify/libraries/victory 856744228 ns/iter (± 28800418) 823330763 ns/iter (± 8991560) 1.04
es/full/minify/libraries/vue 158569815 ns/iter (± 7575003) 149893326 ns/iter (± 3945108) 1.06
es/full/codegen/es3 34035 ns/iter (± 1014) 32325 ns/iter (± 575) 1.05
es/full/codegen/es5 34007 ns/iter (± 807) 32309 ns/iter (± 874) 1.05
es/full/codegen/es2015 34081 ns/iter (± 957) 32335 ns/iter (± 1130) 1.05
es/full/codegen/es2016 34016 ns/iter (± 674) 32269 ns/iter (± 916) 1.05
es/full/codegen/es2017 33999 ns/iter (± 743) 32664 ns/iter (± 1410) 1.04
es/full/codegen/es2018 34008 ns/iter (± 715) 32273 ns/iter (± 669) 1.05
es/full/codegen/es2019 34020 ns/iter (± 1942) 32184 ns/iter (± 737) 1.06
es/full/codegen/es2020 33906 ns/iter (± 842) 32149 ns/iter (± 495) 1.05
es/full/all/es3 200541905 ns/iter (± 8865910) 185618286 ns/iter (± 5086021) 1.08
es/full/all/es5 187712132 ns/iter (± 7367374) 187186209 ns/iter (± 20265378) 1.00
es/full/all/es2015 147288770 ns/iter (± 6736358) 147104205 ns/iter (± 5903807) 1.00
es/full/all/es2016 145597155 ns/iter (± 5191199) 161329879 ns/iter (± 15039864) 0.90
es/full/all/es2017 145379414 ns/iter (± 5165232) 144670050 ns/iter (± 9934192) 1.00
es/full/all/es2018 144724573 ns/iter (± 9131420) 142704662 ns/iter (± 4543639) 1.01
es/full/all/es2019 142600788 ns/iter (± 7385079) 140021092 ns/iter (± 5206629) 1.02
es/full/all/es2020 136994947 ns/iter (± 6100882) 133891968 ns/iter (± 4505645) 1.02
es/full/parser 717720 ns/iter (± 50162) 713844 ns/iter (± 21609) 1.01
es/full/base/fixer 26456 ns/iter (± 818) 26263 ns/iter (± 433) 1.01
es/full/base/resolver_and_hygiene 92926 ns/iter (± 3163) 92195 ns/iter (± 3278) 1.01
serialization of ast node 205 ns/iter (± 1) 205 ns/iter (± 4) 1
serialization of serde 212 ns/iter (± 4) 213 ns/iter (± 7) 1.00

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

Please sign in to comment.