aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-15 16:33:19 +0800
committerGitHub <noreply@github.com>2017-12-15 16:33:19 +0800
commit092d9affb829768e652f14c82080e27893e1f022 (patch)
tree9394317a8202e43deb73301b0c20b5712934f472 /test/compress/reduce_vars.js
parent8f681b1d1721e931852be48720d26ba052eac96c (diff)
downloadtracifyjs-092d9affb829768e652f14c82080e27893e1f022.tar.gz
tracifyjs-092d9affb829768e652f14c82080e27893e1f022.zip
fix `reduce_vars` on `do...while` (#2596)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 9ed9c974..394bb586 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -4867,3 +4867,35 @@ defun_single_use_loop: {
"true",
]
}
+
+do_while: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ function f(a) {
+ do {
+ (function() {
+ a && (c = "PASS");
+ })();
+ } while (a = 0);
+ }
+ var c = "FAIL";
+ f(1);
+ console.log(c);
+ }
+ expect: {
+ function f(a) {
+ do {
+ (function() {
+ a && (c = "PASS");
+ })();
+ } while (a = 0);
+ }
+ var c = "FAIL";
+ f(1);
+ console.log(c);
+ }
+ expect_stdout: "PASS"
+}