File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -12119,7 +12119,11 @@ Compressor.prototype.compress = function(node) {
12119
12119
var exprs = [];
12120
12120
if (self.left.evaluate(compressor) instanceof AST_Node) exprs.push(self.left);
12121
12121
if (self.right.evaluate(compressor) instanceof AST_Node) exprs.push(self.right);
12122
- if (exprs.length < 2) {
12122
+ switch (exprs.length) {
12123
+ case 0:
12124
+ return make_node(AST_True, self).optimize(compressor);
12125
+ case 1:
12126
+ exprs[0] = exprs[0].clone();
12123
12127
exprs.push(make_node(AST_True, self));
12124
12128
return make_sequence(self, exprs).optimize(compressor);
12125
12129
}
Original file line number Diff line number Diff line change @@ -8968,3 +8968,32 @@ issue_5851_2: {
8968
8968
"foo" ,
8969
8969
]
8970
8970
}
8971
+
8972
+ issue_5885: {
8973
+ options = {
8974
+ booleans : true ,
8975
+ evaluate : true ,
8976
+ inline : true ,
8977
+ reduce_vars : true ,
8978
+ side_effects : true ,
8979
+ toplevel : true ,
8980
+ unused : true ,
8981
+ }
8982
+ input: {
8983
+ var a ;
8984
+ f ( ) ;
8985
+ function f ( ) {
8986
+ return ++ a + "foo" ;
8987
+ }
8988
+ console . log ( a = f ( ) ) ;
8989
+ }
8990
+ expect: {
8991
+ var a ;
8992
+ f ( ) ;
8993
+ function f ( ) {
8994
+ return ++ a + "foo" ;
8995
+ }
8996
+ console . log ( a = f ( ) ) ;
8997
+ }
8998
+ expect_stdout: "NaNfoo"
8999
+ }
You can’t perform that action at this time.
0 commit comments