[Pkg-javascript-commits] [uglifyjs] 381/491: scan within IIFEs of assigned values (#2702)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:54 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 2f3bddbacaaafb73ed046090a74ce6558c54a218
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Tue Jan 2 01:24:23 2018 +0800
scan within IIFEs of assigned values (#2702)
fixes #2701
---
lib/compress.js | 5 ++---
test/compress/dead-code.js | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/lib/compress.js b/lib/compress.js
index ee80901..73cc9d7 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4913,9 +4913,8 @@ merge(Compressor.prototype, {
if (reachable) return true;
if (node instanceof AST_Scope && node !== self) {
var parent = scan_scope.parent();
- if (!(parent instanceof AST_Call && parent.expression === node)) {
- node.walk(find_ref);
- }
+ if (parent instanceof AST_Call && parent.expression === node) return;
+ node.walk(find_ref);
return true;
}
});
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index 68ee4b1..32bb88e 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -881,3 +881,31 @@ issue_2692: {
}
expect_stdout: "function"
}
+
+issue_2701: {
+ options = {
+ dead_code: true,
+ inline: false,
+ }
+ input: {
+ function f(a) {
+ return a = function() {
+ return function() {
+ return a;
+ };
+ }();
+ }
+ console.log(typeof f()());
+ }
+ expect: {
+ function f(a) {
+ return a = function() {
+ return function() {
+ return a;
+ };
+ }();
+ }
+ console.log(typeof f()());
+ }
+ expect_stdout: "function"
+}
--
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