enahnce collapse_vars (#5398)
This commit is contained in:
@@ -3182,22 +3182,19 @@ Compressor.prototype.compress = function(node) {
|
|||||||
var defn = last.clone();
|
var defn = last.clone();
|
||||||
defn.value = null;
|
defn.value = null;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
node = node.clone();
|
|
||||||
node.definitions = defns.slice();
|
|
||||||
node.definitions[index] = defn;
|
node.definitions[index] = defn;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
var body = [
|
var body = [ make_node(AST_SimpleStatement, value, { body: value }) ];
|
||||||
make_node(AST_SimpleStatement, value, { body: value }),
|
|
||||||
node.clone(),
|
|
||||||
];
|
|
||||||
body[1].definitions = defns.slice(index);
|
|
||||||
body[1].definitions[0] = defn;
|
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
|
var head = node.clone();
|
||||||
|
head.definitions = defns.slice(0, index);
|
||||||
|
body.unshift(head);
|
||||||
node = node.clone();
|
node = node.clone();
|
||||||
node.definitions = defns.slice(0, index);
|
node.definitions = defns.slice(index);
|
||||||
body.unshift(node);
|
|
||||||
}
|
}
|
||||||
|
body.push(node);
|
||||||
|
node.definitions[0] = defn;
|
||||||
return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { body: body });
|
return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { body: body });
|
||||||
}
|
}
|
||||||
if (!value) return in_list ? List.skip : null;
|
if (!value) return in_list ? List.skip : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user