aboutsummaryrefslogtreecommitdiff
path: root/test/compress/varify.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/varify.js')
-rw-r--r--test/compress/varify.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/compress/varify.js b/test/compress/varify.js
index f60c5474..75d50e6d 100644
--- a/test/compress/varify.js
+++ b/test/compress/varify.js
@@ -523,3 +523,55 @@ default_init: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4933_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ varify: true,
+ }
+ input: {
+ console.log(f());
+ function f() {
+ var a;
+ for (console in a = [ f ]) {
+ const b = a;
+ }
+ }
+ }
+ expect: {
+ console.log(function f() {
+ var a;
+ for (console in a = [ f ]) {
+ const b = a;
+ }
+ }());
+ }
+ expect_stdout: "undefined"
+}
+
+issue_4933_2: {
+ options = {
+ passes: 2,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ varify: true,
+ }
+ input: {
+ console.log(f());
+ function f() {
+ var a;
+ for (console in a = [ f ]) {
+ const b = a;
+ }
+ }
+ }
+ expect: {
+ console.log(function f() {
+ for (console in [ f ]);
+ }());
+ }
+ expect_stdout: "undefined"
+}