aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-01 15:09:53 +0800
committerGitHub <noreply@github.com>2018-02-01 15:09:53 +0800
commit102f994b9d09b3ed0447f02a894fd88fcc903171 (patch)
tree3dfde085bf6c941540620951ac770b8f5cda1b2d /test
parent2a4c68be4f3ed60fa638b66a57e7056f7507da83 (diff)
downloadtracifyjs-102f994b9d09b3ed0447f02a894fd88fcc903171.tar.gz
tracifyjs-102f994b9d09b3ed0447f02a894fd88fcc903171.zip
account for declaration assignment in `collapse_vars` (#2859)
fixes #2858
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index b3617816..f56face6 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -4190,3 +4190,37 @@ return_3: {
}
expect_stdout: "0"
}
+
+issue_2858: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var b;
+ (function() {
+ function f() {
+ a++;
+ }
+ f();
+ var c = f();
+ var a = void 0;
+ c || (b = a);
+ })();
+ console.log(b);
+ }
+ expect: {
+ var b;
+ (function() {
+ function f() {
+ a++;
+ }
+ f();
+ var c = f();
+ var a = void 0;
+ c || (b = a);
+ })();
+ console.log(b);
+ }
+ expect_stdout: "undefined"
+}