File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -12642,6 +12642,7 @@ Compressor.prototype.compress = function(node) {
12642
12642
}
12643
12643
12644
12644
function is_indexFn(node) {
12645
+ while (node instanceof AST_Assign && node.operator == "=") node = node.right;
12645
12646
return node.TYPE == "Call"
12646
12647
&& node.expression instanceof AST_Dot
12647
12648
&& indexFns[node.expression.property];
Original file line number Diff line number Diff line change @@ -471,6 +471,28 @@ unsafe_indexOf: {
471
471
]
472
472
}
473
473
474
+ unsafe_indexOf_assignment: {
475
+ options = {
476
+ booleans : true ,
477
+ comparisons : true ,
478
+ unsafe : true ,
479
+ }
480
+ input: {
481
+ var a ;
482
+ if ( ( a = Object . keys ( { foo : 42 } ) . indexOf ( "bar" ) ) < 0 ) console . log ( "PASS" ) ;
483
+ if ( 0 > ( a = Object . keys ( { foo : 42 } ) . indexOf ( "bar" ) ) ) console . log ( "PASS" ) ;
484
+ }
485
+ expect: {
486
+ var a ;
487
+ if ( ! ~ ( a = Object . keys ( { foo : 42 } ) . indexOf ( "bar" ) ) ) console . log ( "PASS" ) ;
488
+ if ( ! ~ ( a = Object . keys ( { foo : 42 } ) . indexOf ( "bar" ) ) ) console . log ( "PASS" ) ;
489
+ }
490
+ expect_stdout: [
491
+ "PASS" ,
492
+ "PASS" ,
493
+ ]
494
+ }
495
+
474
496
issue_3413: {
475
497
options = {
476
498
comparisons : true ,
You can’t perform that action at this time.
0 commit comments