Simplify iife new fix

as suggested by @rvanvelzen.

Added a test for IIFEs in nested contexts.
This commit is contained in:
kzc
2016-05-15 19:12:17 -04:00
parent bcc1318d4b
commit 5f464b41e2
2 changed files with 33 additions and 3 deletions

View File

@@ -811,9 +811,7 @@ merge(Compressor.prototype, {
if (stat instanceof AST_SimpleStatement) {
stat.body = (function transform(thing) {
return thing.transform(new TreeTransformer(function(node){
if (node instanceof AST_New
&& node.expression instanceof AST_Call
&& node.expression.expression instanceof AST_Function) {
if (node instanceof AST_New) {
return node;
}
if (node instanceof AST_Call && node.expression instanceof AST_Function) {