aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-05-14 18:09:54 +0100
committerGitHub <noreply@github.com>2020-05-15 01:09:54 +0800
commit5ef7060098e231e1c31800f0ebcb19317bf0e077 (patch)
tree54ece930c586de29fad4141c120cfed698c01f4b /test/compress/collapse_vars.js
parent938368ba219f29703b9f9e67c6fb0d1c0723220a (diff)
downloadtracifyjs-5ef7060098e231e1c31800f0ebcb19317bf0e077.tar.gz
tracifyjs-5ef7060098e231e1c31800f0ebcb19317bf0e077.zip
fix corner case in `collapse_vars` (#3898)
fixes #3897
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js34
1 files changed, 34 insertions, 0 deletions
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",
+ ]
+}