Fix negate_iife transform to return a correct tree for nested IIFEs
Fix for #1256, partially reverts d854523783
This commit is contained in:
@@ -831,6 +831,13 @@ merge(Compressor.prototype, {
|
||||
};
|
||||
|
||||
function negate_iifes(statements, compressor) {
|
||||
function is_iife_call(node) {
|
||||
if (node instanceof AST_Call) {
|
||||
return node.expression instanceof AST_Function || is_iife_call(node.expression);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
statements.forEach(function(stat){
|
||||
if (stat instanceof AST_SimpleStatement) {
|
||||
stat.body = (function transform(thing) {
|
||||
@@ -838,7 +845,7 @@ merge(Compressor.prototype, {
|
||||
if (node instanceof AST_New) {
|
||||
return node;
|
||||
}
|
||||
if (node instanceof AST_Call && node.expression instanceof AST_Function) {
|
||||
if (is_iife_call(node)) {
|
||||
return make_node(AST_UnaryPrefix, node, {
|
||||
operator: "!",
|
||||
expression: node
|
||||
|
||||
Reference in New Issue
Block a user