@@ -599,6 +599,7 @@ drop_extends: {
599
599
inline : true ,
600
600
passes : 2 ,
601
601
pure_getters : "strict" ,
602
+ reduce_funcs : true ,
602
603
reduce_vars : true ,
603
604
sequences : true ,
604
605
side_effects : true ,
@@ -921,6 +922,7 @@ single_use_3: {
921
922
922
923
single_use_4: {
923
924
options = {
925
+ reduce_funcs : true ,
924
926
reduce_vars : true ,
925
927
toplevel : true ,
926
928
unused : true ,
@@ -1503,6 +1505,218 @@ keep_instanceof_3: {
1503
1505
node_version: ">=4"
1504
1506
}
1505
1507
1508
+ keep_field_reference_1: {
1509
+ options = {
1510
+ reduce_funcs : true ,
1511
+ reduce_vars : true ,
1512
+ toplevel : true ,
1513
+ unused : true ,
1514
+ }
1515
+ input: {
1516
+ "use strict" ;
1517
+ function f ( ) { }
1518
+ class A {
1519
+ p = f ;
1520
+ }
1521
+ console . log ( new A ( ) . p === new A ( ) . p ? "PASS" : "FAIL" ) ;
1522
+ }
1523
+ expect: {
1524
+ "use strict" ;
1525
+ function f ( ) { }
1526
+ class A {
1527
+ p = f ;
1528
+ }
1529
+ console . log ( new A ( ) . p === new A ( ) . p ? "PASS" : "FAIL" ) ;
1530
+ }
1531
+ expect_stdout: "PASS"
1532
+ node_version: ">=12"
1533
+ }
1534
+
1535
+ keep_field_reference_2: {
1536
+ options = {
1537
+ reduce_funcs : true ,
1538
+ reduce_vars : true ,
1539
+ toplevel : true ,
1540
+ unused : true ,
1541
+ }
1542
+ input: {
1543
+ "use strict" ;
1544
+ function f ( ) { }
1545
+ var A = class {
1546
+ p = f ;
1547
+ } ;
1548
+ console . log ( new A ( ) . p === new A ( ) . p ? "PASS" : "FAIL" ) ;
1549
+ }
1550
+ expect: {
1551
+ "use strict" ;
1552
+ function f ( ) { }
1553
+ var A = class {
1554
+ p = f ;
1555
+ } ;
1556
+ console . log ( new A ( ) . p === new A ( ) . p ? "PASS" : "FAIL" ) ;
1557
+ }
1558
+ expect_stdout: "PASS"
1559
+ node_version: ">=12"
1560
+ }
1561
+
1562
+ keep_field_reference_3: {
1563
+ options = {
1564
+ reduce_funcs : true ,
1565
+ reduce_vars : true ,
1566
+ toplevel : true ,
1567
+ unused : true ,
1568
+ }
1569
+ input: {
1570
+ "use strict" ;
1571
+ class A { }
1572
+ class B {
1573
+ p = A ;
1574
+ }
1575
+ console . log ( new B ( ) . p === new B ( ) . p ? "PASS" : "FAIL" ) ;
1576
+ }
1577
+ expect: {
1578
+ "use strict" ;
1579
+ class A { }
1580
+ class B {
1581
+ p = A ;
1582
+ }
1583
+ console . log ( new B ( ) . p === new B ( ) . p ? "PASS" : "FAIL" ) ;
1584
+ }
1585
+ expect_stdout: "PASS"
1586
+ node_version: ">=12"
1587
+ }
1588
+
1589
+ keep_field_reference_4: {
1590
+ options = {
1591
+ reduce_funcs : true ,
1592
+ reduce_vars : true ,
1593
+ toplevel : true ,
1594
+ unused : true ,
1595
+ }
1596
+ input: {
1597
+ "use strict" ;
1598
+ var A = class { } ;
1599
+ var B = class {
1600
+ p = A ;
1601
+ } ;
1602
+ console . log ( new B ( ) . p === new B ( ) . p ? "PASS" : "FAIL" ) ;
1603
+ }
1604
+ expect: {
1605
+ "use strict" ;
1606
+ var A = class { } ;
1607
+ var B = class {
1608
+ p = A ;
1609
+ } ;
1610
+ console . log ( new B ( ) . p === new B ( ) . p ? "PASS" : "FAIL" ) ;
1611
+ }
1612
+ expect_stdout: "PASS"
1613
+ node_version: ">=12"
1614
+ }
1615
+
1616
+ keep_static_field_reference_1: {
1617
+ options = {
1618
+ reduce_funcs : true ,
1619
+ reduce_vars : true ,
1620
+ toplevel : true ,
1621
+ unused : true ,
1622
+ }
1623
+ input: {
1624
+ "use strict" ;
1625
+ function f ( ) { }
1626
+ class A {
1627
+ static P = f ;
1628
+ }
1629
+ console . log ( A . P === A . P ? "PASS" : "FAIL" ) ;
1630
+ }
1631
+ expect: {
1632
+ "use strict" ;
1633
+ class A {
1634
+ static P = function ( ) { } ;
1635
+ }
1636
+ console . log ( A . P === A . P ? "PASS" : "FAIL" ) ;
1637
+ }
1638
+ expect_stdout: "PASS"
1639
+ node_version: ">=12"
1640
+ }
1641
+
1642
+ keep_static_field_reference_2: {
1643
+ options = {
1644
+ reduce_funcs : true ,
1645
+ reduce_vars : true ,
1646
+ toplevel : true ,
1647
+ unused : true ,
1648
+ }
1649
+ input: {
1650
+ "use strict" ;
1651
+ function f ( ) { }
1652
+ var A = class {
1653
+ static P = f ;
1654
+ } ;
1655
+ console . log ( A . P === A . P ? "PASS" : "FAIL" ) ;
1656
+ }
1657
+ expect: {
1658
+ "use strict" ;
1659
+ var A = class {
1660
+ static P = function ( ) { } ;
1661
+ } ;
1662
+ console . log ( A . P === A . P ? "PASS" : "FAIL" ) ;
1663
+ }
1664
+ expect_stdout: "PASS"
1665
+ node_version: ">=12"
1666
+ }
1667
+
1668
+ keep_static_field_reference_3: {
1669
+ options = {
1670
+ reduce_funcs : true ,
1671
+ reduce_vars : true ,
1672
+ toplevel : true ,
1673
+ unused : true ,
1674
+ }
1675
+ input: {
1676
+ "use strict" ;
1677
+ class A { }
1678
+ class B {
1679
+ static P = A ;
1680
+ }
1681
+ console . log ( B . P === B . P ? "PASS" : "FAIL" ) ;
1682
+ }
1683
+ expect: {
1684
+ "use strict" ;
1685
+ class B {
1686
+ static P = class { } ;
1687
+ }
1688
+ console . log ( B . P === B . P ? "PASS" : "FAIL" ) ;
1689
+ }
1690
+ expect_stdout: "PASS"
1691
+ node_version: ">=12"
1692
+ }
1693
+
1694
+ keep_static_field_reference_4: {
1695
+ options = {
1696
+ reduce_funcs : true ,
1697
+ reduce_vars : true ,
1698
+ toplevel : true ,
1699
+ unused : true ,
1700
+ }
1701
+ input: {
1702
+ "use strict" ;
1703
+ var A = class { } ;
1704
+ var B = class {
1705
+ static P = A ;
1706
+ } ;
1707
+ console . log ( B . P === B . P ? "PASS" : "FAIL" ) ;
1708
+ }
1709
+ expect: {
1710
+ "use strict" ;
1711
+ var B = class {
1712
+ static P = class { } ;
1713
+ } ;
1714
+ console . log ( B . P === B . P ? "PASS" : "FAIL" ) ;
1715
+ }
1716
+ expect_stdout: "PASS"
1717
+ node_version: ">=12"
1718
+ }
1719
+
1506
1720
issue_805_1: {
1507
1721
options = {
1508
1722
inline : true ,
@@ -2313,6 +2527,7 @@ issue_4962_1: {
2313
2527
options = {
2314
2528
ie : true ,
2315
2529
inline : true ,
2530
+ reduce_funcs : true ,
2316
2531
reduce_vars : true ,
2317
2532
unused : true ,
2318
2533
}
@@ -2344,6 +2559,7 @@ issue_4962_1_strict: {
2344
2559
options = {
2345
2560
ie : true ,
2346
2561
inline : true ,
2562
+ reduce_funcs : true ,
2347
2563
reduce_vars : true ,
2348
2564
unused : true ,
2349
2565
}
@@ -2371,6 +2587,7 @@ issue_4962_1_strict_direct: {
2371
2587
options = {
2372
2588
ie : true ,
2373
2589
inline : true ,
2590
+ reduce_funcs : true ,
2374
2591
reduce_vars : true ,
2375
2592
unused : true ,
2376
2593
}
@@ -2402,6 +2619,7 @@ issue_4962_2: {
2402
2619
options = {
2403
2620
ie : true ,
2404
2621
inline : true ,
2622
+ reduce_funcs : true ,
2405
2623
reduce_vars : true ,
2406
2624
unused : true ,
2407
2625
}
@@ -2433,6 +2651,7 @@ issue_4962_2_strict: {
2433
2651
options = {
2434
2652
ie : true ,
2435
2653
inline : true ,
2654
+ reduce_funcs : true ,
2436
2655
reduce_vars : true ,
2437
2656
unused : true ,
2438
2657
}
@@ -2461,6 +2680,7 @@ issue_4962_2_strict_direct: {
2461
2680
options = {
2462
2681
ie : true ,
2463
2682
inline : true ,
2683
+ reduce_funcs : true ,
2464
2684
reduce_vars : true ,
2465
2685
unused : true ,
2466
2686
}
@@ -2495,6 +2715,7 @@ issue_4962_2_strict_direct_inline: {
2495
2715
ie : true ,
2496
2716
inline : true ,
2497
2717
passes : 2 ,
2718
+ reduce_funcs : true ,
2498
2719
reduce_vars : true ,
2499
2720
unused : true ,
2500
2721
}
@@ -2878,6 +3099,7 @@ issue_5053_4: {
2878
3099
issue_5082_1: {
2879
3100
options = {
2880
3101
inline : true ,
3102
+ reduce_funcs : true ,
2881
3103
reduce_vars : true ,
2882
3104
unused : true ,
2883
3105
}
@@ -2910,6 +3132,7 @@ issue_5082_1: {
2910
3132
issue_5082_1_strict: {
2911
3133
options = {
2912
3134
inline : true ,
3135
+ reduce_funcs : true ,
2913
3136
reduce_vars : true ,
2914
3137
unused : true ,
2915
3138
}
@@ -2943,6 +3166,7 @@ issue_5082_2: {
2943
3166
options = {
2944
3167
inline : true ,
2945
3168
passes : 2 ,
3169
+ reduce_funcs : true ,
2946
3170
reduce_vars : true ,
2947
3171
unused : true ,
2948
3172
}
@@ -2976,6 +3200,7 @@ issue_5082_2_static: {
2976
3200
options = {
2977
3201
inline : true ,
2978
3202
passes : 2 ,
3203
+ reduce_funcs : true ,
2979
3204
reduce_vars : true ,
2980
3205
unused : true ,
2981
3206
}
0 commit comments