aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-08 12:39:57 +0800
committerGitHub <noreply@github.com>2017-03-08 12:39:57 +0800
commitc7cdcf06a65b70b557894c1680fc099d3c7aca6a (patch)
treeddcd4f34e8c11e0c7cfa942380d05e9ed66b06c4 /test/compress
parent3ee55748d466f36aff54383b53fb3deca144de97 (diff)
downloadtracifyjs-c7cdcf06a65b70b557894c1680fc099d3c7aca6a.tar.gz
tracifyjs-c7cdcf06a65b70b557894c1680fc099d3c7aca6a.zip
fix function name eliminiation (#1576)
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out. fixes #1573 fixes #1575
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/reduce_vars.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 53e28152..10dc9d98 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -1122,3 +1122,25 @@ defun_label: {
}();
}
}
+
+double_reference: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ var g = function g() {
+ g();
+ };
+ g();
+ }
+ }
+ expect: {
+ function f() {
+ (function g() {
+ g();
+ })();
+ }
+ }
+}