File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -3409,6 +3409,7 @@ Compressor.prototype.compress = function(node) {
34093409 var find_arguments = scope.uses_arguments && !compressor.has_directive("use strict");
34103410 var scan_toplevel = scope instanceof AST_Toplevel;
34113411 var tw = new TreeWalker(function(node) {
3412+ if (node.inlined_node) node.inlined_node.walk(tw);
34123413 var value;
34133414 if (node instanceof AST_SymbolRef) {
34143415 value = node.fixed_value();
Original file line number Diff line number Diff line change @@ -9076,3 +9076,68 @@ issue_5895_2: {
90769076 "foo" ,
90779077 ]
90789078}
9079+
9080+ issue_5924: {
9081+ options = {
9082+ collapse_vars : true ,
9083+ inline : true ,
9084+ reduce_vars : true ,
9085+ toplevel : true ,
9086+ }
9087+ input: {
9088+ var a = 42 ;
9089+ function f ( ) {
9090+ return a - 41 ;
9091+ }
9092+ function g ( ) {
9093+ return f ;
9094+ }
9095+ var b = f ( ) ;
9096+ a -- ;
9097+ console . log ( b ? "PASS" : "FAIL" ) ;
9098+ }
9099+ expect: {
9100+ var a = 42 ;
9101+ function f ( ) {
9102+ return a - 41 ;
9103+ }
9104+ function g ( ) {
9105+ return f ;
9106+ }
9107+ var b = f ( ) ;
9108+ a -- ;
9109+ console . log ( b ? "PASS" : "FAIL" ) ;
9110+ }
9111+ expect_stdout: "PASS"
9112+ }
9113+
9114+ issue_5925: {
9115+ options = {
9116+ collapse_vars : true ,
9117+ inline : true ,
9118+ reduce_vars : true ,
9119+ }
9120+ input: {
9121+ var a = 42 ;
9122+ console . log ( function ( ) {
9123+ function f ( ) {
9124+ return + a - 41 ;
9125+ }
9126+ var b = f ( f ) ;
9127+ a -- ;
9128+ return b ;
9129+ } ( ) ? "PASS" : "FAIL" ) ;
9130+ }
9131+ expect: {
9132+ var a = 42 ;
9133+ console . log ( function ( ) {
9134+ function f ( ) {
9135+ return + a - 41 ;
9136+ }
9137+ var b = f ( f ) ;
9138+ a -- ;
9139+ return b ;
9140+ } ( ) ? "PASS" : "FAIL" ) ;
9141+ }
9142+ expect_stdout: "PASS"
9143+ }
You can’t perform that action at this time.
0 commit comments