Hoist functions when reversing if (x) return; ... vs. if (!x) ...
Fixes #1052
This commit is contained in:
27
test/compress/issue-1052.js
Normal file
27
test/compress/issue-1052.js
Normal file
@@ -0,0 +1,27 @@
|
||||
hoist_funs_when_handling_if_return_rerversal: {
|
||||
options = { if_return: true, hoist_funs: false };
|
||||
input: {
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
if ( !window ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function f() {}
|
||||
function g() {}
|
||||
} )();
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
function f() {}
|
||||
function g() {}
|
||||
|
||||
// NOTE: other compression steps will reduce this
|
||||
// down to just `window`.
|
||||
if ( window );
|
||||
} )();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user