aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-11-09 20:00:58 +0800
committerGitHub <noreply@github.com>2017-11-09 20:00:58 +0800
commit246d9d4e83e857a26347944ada65fea95ad6381d (patch)
treed7c38d6d37bfc71323032b0adca416b429a0e741 /lib
parent4c0b0177b6fa556c31f0099c6d52a4ad4f670ba3 (diff)
downloadtracifyjs-246d9d4e83e857a26347944ada65fea95ad6381d.tar.gz
tracifyjs-246d9d4e83e857a26347944ada65fea95ad6381d.zip
remove hack in `collapse_vars` (#2457)
fixes #2456
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6354197d..e457d808 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1062,7 +1062,7 @@ merge(Compressor.prototype, {
var found = false;
return statements[stat_index].transform(new TreeTransformer(function(node, descend, in_list) {
if (found) return node;
- if (node === expr) {
+ if (node === expr || node.body === expr) {
found = true;
if (node instanceof AST_VarDef) {
drop_decl(node.name.definition());
@@ -1076,7 +1076,6 @@ merge(Compressor.prototype, {
case 0: return null;
case 1: return node.expressions[0];
}
- if (node instanceof AST_SimpleStatement && !node.body) return null;
}));
}