aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-02 15:46:05 +0800
committerGitHub <noreply@github.com>2017-12-02 15:46:05 +0800
commit77332a03153285f5e521c99c3b5d796bf5698ef7 (patch)
tree8e2eefe6fa5fe317e36d6a2b7e2ae707cc8efdd2 /lib/compress.js
parent85c56adbd19bff5e7bc2a59dd937799b7bc5a8d4 (diff)
downloadtracifyjs-77332a03153285f5e521c99c3b5d796bf5698ef7.tar.gz
tracifyjs-77332a03153285f5e521c99c3b5d796bf5698ef7.zip
fix `dead_code` on `for` (#2552)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 7d87c4a6..914fdd06 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3128,9 +3128,6 @@ merge(Compressor.prototype, {
if (!cond) {
var body = [];
extract_declarations_from_unreachable_code(compressor, self.body, body);
- body.push(make_node(AST_SimpleStatement, self.condition, {
- body: self.condition
- }));
if (self.init instanceof AST_Statement) {
body.push(self.init);
} else if (self.init) {
@@ -3138,6 +3135,9 @@ merge(Compressor.prototype, {
body: self.init
}));
}
+ body.push(make_node(AST_SimpleStatement, self.condition, {
+ body: self.condition
+ }));
return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
}
}