avoid generating ternary with spread (#2293)

fixes #2292
This commit is contained in:
kzc
2017-08-30 12:57:07 -04:00
committed by Alex Lam S.L
parent 067d52b6ba
commit 2779a29a86
2 changed files with 45 additions and 0 deletions

View File

@@ -4500,6 +4500,8 @@ merge(Compressor.prototype, {
&& alternative.TYPE === consequent.TYPE
&& consequent.args.length == 1
&& alternative.args.length == 1
&& !(consequent.args[0] instanceof AST_Expansion)
&& !(alternative.args[0] instanceof AST_Expansion)
&& consequent.expression.equivalent_to(alternative.expression)
&& !consequent.expression.has_side_effects(compressor)) {
consequent.args[0] = make_node(AST_Conditional, self, {