aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-17 09:57:50 +0800
committerGitHub <noreply@github.com>2019-10-17 09:57:50 +0800
commitb1279a46d9801bbc3eee8c4ea90422dd7582b928 (patch)
treedf40e34f2964535bd1e2f5de8719050e54515f65 /test/compress
parentb571619d3129727da2fddd2fadff1ea98625a9a9 (diff)
downloadtracifyjs-b1279a46d9801bbc3eee8c4ea90422dd7582b928.tar.gz
tracifyjs-b1279a46d9801bbc3eee8c4ea90422dd7582b928.zip
fix corner case in `sequences` (#3491)
fixes #3490
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/sequences.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 08a06790..fbca559a 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -1006,3 +1006,66 @@ angularjs_chain: {
}
}
}
+
+issue_3490_1: {
+ options = {
+ conditionals: true,
+ dead_code: true,
+ inline: true,
+ sequences: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ var b = 42, c = "FAIL";
+ if ({
+ 3: function() {
+ var a;
+ return (a && a.p) < this;
+ }(),
+ }) c = "PASS";
+ if (b) while ("" == typeof d);
+ console.log(c, b);
+ }
+ expect: {
+ var b = 42, c = "FAIL";
+ if (function() {
+ var a;
+ a && a.p;
+ }(), c = "PASS", b) while ("" == typeof d);
+ console.log(c, b);
+ }
+ expect_stdout: "PASS 42"
+}
+
+issue_3490_2: {
+ options = {
+ conditionals: true,
+ dead_code: true,
+ evaluate: true,
+ inline: true,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ var b = 42, c = "FAIL";
+ if ({
+ 3: function() {
+ var a;
+ return (a && a.p) < this;
+ }(),
+ }) c = "PASS";
+ if (b) for (; "" == typeof d;);
+ console.log(c, b);
+ }
+ expect: {
+ var b = 42, c = "FAIL";
+ for (function() {
+ var a;
+ }(), c = "PASS", b; "" == typeof d;);
+ console.log(c, b);
+ }
+ expect_stdout: "PASS 42"
+}