From 092d9affb829768e652f14c82080e27893e1f022 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 15 Dec 2017 16:33:19 +0800 Subject: fix `reduce_vars` on `do...while` (#2596) --- test/compress/reduce_vars.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/compress/reduce_vars.js') 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" +} -- cgit v1.2.3