File tree Expand file tree Collapse file tree 2 files changed +113
-1
lines changed Expand file tree Collapse file tree 2 files changed +113
-1
lines changed Original file line number Diff line number Diff line change @@ -10784,7 +10784,9 @@ Compressor.prototype.compress = function(node) {
10784
10784
});
10785
10785
child = scope;
10786
10786
scope = compressor.parent(level++);
10787
- if (scope instanceof AST_DWLoop) {
10787
+ if (scope instanceof AST_ClassField) {
10788
+ if (!scope.static) return false;
10789
+ } else if (scope instanceof AST_DWLoop) {
10788
10790
in_loop = [];
10789
10791
} else if (scope instanceof AST_For) {
10790
10792
if (scope.init === child) continue;
Original file line number Diff line number Diff line change @@ -3331,3 +3331,113 @@ issue_5512: {
3331
3331
expect_stdout: "PASS"
3332
3332
node_version: ">=16"
3333
3333
}
3334
+
3335
+ issue_5531_1: {
3336
+ options = {
3337
+ inline : true ,
3338
+ toplevel : true ,
3339
+ }
3340
+ input: {
3341
+ class A {
3342
+ p = function ( ) {
3343
+ var a = function f ( ) {
3344
+ if ( ! a )
3345
+ console . log ( "foo" ) ;
3346
+ return 42 ;
3347
+ } ( a ++ ) ;
3348
+ } ( ) ;
3349
+ }
3350
+ new A ( ) ;
3351
+ new A ( ) ;
3352
+ }
3353
+ expect: {
3354
+ class A {
3355
+ p = function ( ) {
3356
+ var a = function f ( ) {
3357
+ if ( ! a )
3358
+ console . log ( "foo" ) ;
3359
+ return 42 ;
3360
+ } ( a ++ ) ;
3361
+ } ( ) ;
3362
+ }
3363
+ new A ( ) ;
3364
+ new A ( ) ;
3365
+ }
3366
+ expect_stdout: [
3367
+ "foo" ,
3368
+ "foo" ,
3369
+ ]
3370
+ node_version: ">=12"
3371
+ }
3372
+
3373
+ issue_5531_2: {
3374
+ options = {
3375
+ inline : true ,
3376
+ toplevel : true ,
3377
+ }
3378
+ input: {
3379
+ class A {
3380
+ static p = function ( ) {
3381
+ var a = function f ( ) {
3382
+ if ( ! a )
3383
+ console . log ( "foo" ) ;
3384
+ return 42 ;
3385
+ } ( a ++ ) ;
3386
+ } ( ) ;
3387
+ }
3388
+ new A ( ) ;
3389
+ new A ( ) ;
3390
+ }
3391
+ expect: {
3392
+ class A {
3393
+ static p = ( a = function f ( ) {
3394
+ if ( ! a )
3395
+ console . log ( "foo" ) ;
3396
+ return 42 ;
3397
+ } ( a ++ ) , void 0 ) ;
3398
+ }
3399
+ var a ;
3400
+ new A ( ) ;
3401
+ new A ( ) ;
3402
+ }
3403
+ expect_stdout: "foo"
3404
+ node_version: ">=12"
3405
+ }
3406
+
3407
+ issue_5531_3: {
3408
+ options = {
3409
+ inline : true ,
3410
+ }
3411
+ input: {
3412
+ class A {
3413
+ static {
3414
+ ( function ( ) {
3415
+ var a = function f ( ) {
3416
+ if ( ! a )
3417
+ console . log ( "foo" ) ;
3418
+ return 42 ;
3419
+ } ( a ++ ) ;
3420
+ } ) ( ) ;
3421
+ }
3422
+ }
3423
+ new A ( ) ;
3424
+ new A ( ) ;
3425
+ }
3426
+ expect: {
3427
+ class A {
3428
+ static {
3429
+ a = function f ( ) {
3430
+ if ( ! a )
3431
+ console . log ( "foo" ) ;
3432
+ return 42 ;
3433
+ } ( a ++ ) ,
3434
+ void 0 ;
3435
+ var a ;
3436
+ }
3437
+ }
3438
+ new A ( ) ;
3439
+ new A ( ) ;
3440
+ }
3441
+ expect_stdout: "foo"
3442
+ node_version: ">=16"
3443
+ }
You can’t perform that action at this time.
0 commit comments