aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-02 18:41:10 +0100
committerGitHub <noreply@github.com>2020-09-03 01:41:10 +0800
commit375ebe316d8ff1a421c1cafc95d64e3377f7737b (patch)
treebaa24cfb6cb1b5f6fef5765bda97eeca71a31389 /lib/compress.js
parent2500930234304c89d6b9a87cb95fe07d1a8bc6c5 (diff)
downloadtracifyjs-375ebe316d8ff1a421c1cafc95d64e3377f7737b.tar.gz
tracifyjs-375ebe316d8ff1a421c1cafc95d64e3377f7737b.zip
enhance `join_vars` (#4089)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6761c246..9aa70ef9 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2644,6 +2644,14 @@ merge(Compressor.prototype, {
defs = stat.init;
}
} else if (stat instanceof AST_ForIn) {
+ if (defs && defs.TYPE == stat.init.TYPE) {
+ defs.definitions = defs.definitions.concat(stat.init.definitions);
+ var name = stat.init.definitions[0].name;
+ var ref = make_node(AST_SymbolRef, name, name);
+ name.definition().references.push(ref);
+ stat.init = ref;
+ CHANGED = true;
+ }
stat.object = join_assigns_expr(stat.object);
} else if (stat instanceof AST_If) {
stat.condition = join_assigns_expr(stat.condition);