aboutsummaryrefslogtreecommitdiff
path: root/test/compress/assignment.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-05-30 05:01:53 +0800
committerGitHub <noreply@github.com>2019-05-30 05:01:53 +0800
commit9d3b1efd86d659c6519cc74b7f8b232e07e0675e (patch)
tree2127ceabe6c27b063f0bc1a48cab5fe1b03498b3 /test/compress/assignment.js
parent482e1baea3672fc1bc39594a5615487d05a15f5f (diff)
downloadtracifyjs-9d3b1efd86d659c6519cc74b7f8b232e07e0675e.tar.gz
tracifyjs-9d3b1efd86d659c6519cc74b7f8b232e07e0675e.zip
fix corner case in `assignments` (#3430)
fixes #3429
Diffstat (limited to 'test/compress/assignment.js')
-rw-r--r--test/compress/assignment.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/assignment.js b/test/compress/assignment.js
index ecd0ac4a..5ca7440a 100644
--- a/test/compress/assignment.js
+++ b/test/compress/assignment.js
@@ -327,3 +327,49 @@ issue_3427: {
}
expect: {}
}
+
+issue_3429_1: {
+ options = {
+ assignments: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a = "PASS";
+ (function(b) {
+ b && (b = a = "FAIL");
+ })();
+ console.log(a);
+ }
+ expect: {
+ var a = "PASS";
+ (function(b) {
+ b = b && (a = "FAIL");
+ })();
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
+
+issue_3429_2: {
+ options = {
+ assignments: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a;
+ (function(b) {
+ b || (b = a = "FAIL");
+ })(42);
+ console.log(a);
+ }
+ expect: {
+ var a;
+ (function(b) {
+ b = b || (a = "FAIL");
+ })(42);
+ console.log(a);
+ }
+ expect_stdout: "undefined"
+}