[Pkg-javascript-commits] [uglifyjs] 207/491: correctly count declarations after `hoist_vars` (#2297)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:36 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit 3f355866cf903c40c2bab2cd841ab2b56a2bacf1
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Sun Sep 3 17:23:31 2017 +0800
correctly count declarations after `hoist_vars` (#2297)
fixes #2295
---
lib/compress.js | 1 +
test/compress/hoist_vars.js | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/compress.js b/lib/compress.js
index 9121d0c..b6a984c 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3113,6 +3113,7 @@ merge(Compressor.prototype, {
}));
if (reduce_vars) name.definition().fixed = false;
}
+ remove(def.name.definition().orig, def.name);
return a;
}, []);
if (assignments.length == 0) return null;
diff --git a/test/compress/hoist_vars.js b/test/compress/hoist_vars.js
index 6fe1c77..6aa1f7b 100644
--- a/test/compress/hoist_vars.js
+++ b/test/compress/hoist_vars.js
@@ -88,3 +88,24 @@ sequences_funs: {
}
}
}
+
+issue_2295: {
+ options = {
+ collapse_vars: true,
+ hoist_vars: true,
+ }
+ input: {
+ function foo(o) {
+ var a = o.a;
+ if (a) return a;
+ var a = 1;
+ }
+ }
+ expect: {
+ function foo(o) {
+ var a = o.a;
+ if (a) return a;
+ a = 1;
+ }
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list