remove extraneous ! before AST_Arrow (#2185)

This commit is contained in:
Alex Lam S.L
2017-06-30 11:17:58 +08:00
committed by GitHub
parent a938fe5e1f
commit 52cc21d999
2 changed files with 8 additions and 8 deletions

View File

@@ -561,8 +561,8 @@ merge(Compressor.prototype, {
return orig.length == 1 && orig[0] instanceof AST_SymbolLambda; return orig.length == 1 && orig[0] instanceof AST_SymbolLambda;
}); });
function is_func_expr(node, traditional) { function is_func_expr(node) {
return node instanceof AST_Function || !traditional && node instanceof AST_Arrow; return node instanceof AST_Arrow || node instanceof AST_Function;
} }
function is_lhs_read_only(lhs) { function is_lhs_read_only(lhs) {
@@ -706,9 +706,9 @@ merge(Compressor.prototype, {
return x; return x;
}; };
function is_iife_call(node, traditional) { function is_iife_call(node) {
if (node instanceof AST_Call && !(node instanceof AST_New)) { if (node instanceof AST_Call && !(node instanceof AST_New)) {
return is_func_expr(node.expression, traditional) || is_iife_call(node.expression); return node.expression instanceof AST_Function || is_iife_call(node.expression);
} }
return false; return false;
} }
@@ -3452,7 +3452,7 @@ merge(Compressor.prototype, {
} }
if (compressor.option("negate_iife") if (compressor.option("negate_iife")
&& compressor.parent() instanceof AST_SimpleStatement && compressor.parent() instanceof AST_SimpleStatement
&& is_iife_call(self, true)) { && is_iife_call(self)) {
return self.negate(compressor, true); return self.negate(compressor, true);
} }
var ev = self.evaluate(compressor); var ev = self.evaluate(compressor);

View File

@@ -312,7 +312,7 @@ issue_2105_1: {
}); });
} }
expect: { expect: {
!void (() => { void (() => {
var quux = () => { var quux = () => {
console.log("PASS"); console.log("PASS");
}; };
@@ -357,7 +357,7 @@ issue_2105_2: {
}); });
} }
expect: { expect: {
!void (() => { void (() => {
var quux = () => { var quux = () => {
console.log("PASS"); console.log("PASS");
}; };
@@ -528,7 +528,7 @@ issue_2084: {
} }
expect: { expect: {
var c = 0; var c = 0;
!((c) => { ((c) => {
c = 1 + c, c = 1 + c,
c = 1 + (c = 0), c = 1 + (c = 0),
0 !== 23..toString() && (c = 1 + c); 0 !== 23..toString() && (c = 1 + c);