From 4fc39d8dadcec807be9d80ceb1d585f41b20c961 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 19 May 2018 05:45:14 +0800 Subject: fix corner case in `collapse_vars` (#3139) --- test/compress/collapse_vars.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index c915041f..bcc8b833 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4931,6 +4931,27 @@ collapse_rhs_lhs_2: { expect_stdout: "PASS" } +collapse_rhs_loop: { + options = { + collapse_vars: true, + } + input: { + var s; + s = "PASS"; + for (var m, r = /(.*)<\/tpl>/; m = s.match(r);) + s = s.replace(m[0], m[1]); + console.log(s); + } + expect: { + var s; + s = "PASS"; + for (var m, r = /(.*)<\/tpl>/; m = s.match(r);) + s = s.replace(m[0], m[1]); + console.log(s); + } + expect_stdout: "PASS" +} + collapse_rhs_side_effects: { options = { collapse_vars: true, -- cgit v1.2.3