File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -2862,10 +2862,10 @@ merge(Compressor.prototype, {
2862
2862
case "+" : return + v ;
2863
2863
case "++" :
2864
2864
case "--" :
2865
- if ( e instanceof AST_SymbolRef ) {
2866
- var refs = e . definition ( ) . references ;
2867
- if ( refs [ refs . length - 1 ] === e ) return v ;
2868
- }
2865
+ if ( ! ( e instanceof AST_SymbolRef ) ) return this ;
2866
+ var refs = e . definition ( ) . references ;
2867
+ if ( refs [ refs . length - 1 ] !== e ) return this ;
2868
+ return HOP ( e , "_eval" ) ? + ( this . operator [ 0 ] + 1 ) + + v : v ;
2869
2869
}
2870
2870
return this ;
2871
2871
} ) ;
Original file line number Diff line number Diff line change @@ -1838,3 +1838,24 @@ recursive_function_2: {
1838
1838
}
1839
1839
expect_stdout: "120"
1840
1840
}
1841
+
1842
+ issue_3558: {
1843
+ options = {
1844
+ evaluate : true ,
1845
+ reduce_vars : true ,
1846
+ toplevel : true ,
1847
+ }
1848
+ input: {
1849
+ function f ( a ) {
1850
+ return 1 + -- a ;
1851
+ }
1852
+ console . log ( f ( true ) , f ( false ) ) ;
1853
+ }
1854
+ expect: {
1855
+ function f ( a ) {
1856
+ return 1 + -- a ;
1857
+ }
1858
+ console . log ( 1 , 0 ) ;
1859
+ }
1860
+ expect_stdout: "1 0"
1861
+ }
You can’t perform that action at this time.
0 commit comments