Merge branch 'master' into harmony

This commit is contained in:
Richard van Velzen
2016-08-17 20:21:38 +02:00
5 changed files with 30 additions and 4 deletions

View File

@@ -847,6 +847,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) {
@@ -854,7 +861,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