From 5ef7060098e231e1c31800f0ebcb19317bf0e077 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Thu, 14 May 2020 18:09:54 +0100 Subject: fix corner case in `collapse_vars` (#3898) fixes #3897 --- test/compress/collapse_vars.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/compress/collapse_vars.js') diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 0dd8754d..97975b1c 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -8050,3 +8050,37 @@ issue_3894: { "PASS", ] } + +issue_3897: { + options = { + collapse_vars: true, + } + input: { + var a = 0; + (function() { + function f(b) { + b = a = 1 + a; + a = 1 + a; + console.log(b); + } + f(); + })(); + console.log(a); + } + expect: { + var a = 0; + (function() { + function f(b) { + b = a = 1 + a; + a = 1 + a; + console.log(b); + } + f(); + })(); + console.log(a); + } + expect_stdout: [ + "1", + "2", + ] +} -- cgit v1.2.3