aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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"
+}