aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 7a16ba86..9121d0ce 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2423,17 +2423,18 @@ merge(Compressor.prototype, {
// We fix it at this stage by moving the `var` outside the `for`.
if (node instanceof AST_For) {
descend(node, this);
+ var block;
if (node.init instanceof AST_BlockStatement) {
- var block = node.init;
+ block = node.init;
node.init = block.body.pop();
block.body.push(node);
- return in_list ? MAP.splice(block.body) : block;
- } else if (node.init instanceof AST_SimpleStatement) {
+ }
+ if (node.init instanceof AST_SimpleStatement) {
node.init = node.init.body;
} else if (is_empty(node.init)) {
node.init = null;
}
- return node;
+ return !block ? node : in_list ? MAP.splice(block.body) : block;
}
if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) {
descend(node, this);