fix unsafe join() on array literal with spread (#2347)

fixes #2345
This commit is contained in:
kzc
2017-10-05 12:57:00 -04:00
committed by Alex Lam S.L
parent 873755b35c
commit 336b1add4f
2 changed files with 28 additions and 2 deletions

View File

@@ -3437,7 +3437,9 @@ merge(Compressor.prototype, {
}
var elements = [];
var consts = [];
exp.expression.elements.forEach(function(el) {
for (var i = 0, len = exp.expression.elements.length; i < len; i++) {
var el = exp.expression.elements[i];
if (el instanceof AST_Expansion) break EXIT;
var value = el.evaluate(compressor);
if (value !== el) {
consts.push(value);
@@ -3450,7 +3452,7 @@ merge(Compressor.prototype, {
}
elements.push(el);
}
});
}
if (consts.length > 0) {
elements.push(make_node(AST_String, self, {
value: consts.join(separator)