Hoist functions when reversing if (x) return; ... vs. if (!x) ...

Fixes #1052
This commit is contained in:
Richard van Velzen
2016-04-23 23:48:33 +02:00
parent c55dd5ed74
commit 4fe630431c
2 changed files with 43 additions and 2 deletions

View 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 );
} )();
}
}