aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-03-13 21:56:38 +0800
committerGitHub <noreply@github.com>2019-03-13 21:56:38 +0800
commitb052f62710df6b09caca2b82ff2303ad0079be58 (patch)
treeb69a0ea42f3e869a6cd7b9156a527d4eb578e113 /test/compress/reduce_vars.js
parentd4ac84b25518740959df18d0ed057bd0c6cba302 (diff)
downloadtracifyjs-b052f62710df6b09caca2b82ff2303ad0079be58.tar.gz
tracifyjs-b052f62710df6b09caca2b82ff2303ad0079be58.zip
fix corner case in `reduce_vars` (#3332)
fixes #3267
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js100
1 files changed, 100 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 0bb682ab..32a06b10 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -6586,3 +6586,103 @@ issue_3240_4: {
"1",
]
}
+
+issues_3267_1: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ dead_code: true,
+ evaluate: true,
+ inline: true,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ (function(x) {
+ x();
+ })(function() {
+ (function(i) {
+ if (i)
+ return console.log("PASS");
+ throw "FAIL";
+ })(Object());
+ });
+ }
+ expect: {
+ !function(i) {
+ if (i)
+ return console.log("PASS");
+ throw "FAIL";
+ }(Object());
+ }
+ expect_stdout: "PASS"
+}
+
+issues_3267_2: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ dead_code: true,
+ evaluate: true,
+ inline: true,
+ keep_fargs: false,
+ passes: 2,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ (function(x) {
+ x();
+ })(function() {
+ (function(i) {
+ if (i)
+ return console.log("PASS");
+ throw "FAIL";
+ })(Object());
+ });
+ }
+ expect: {
+ !function() {
+ if (Object())
+ return console.log("PASS");
+ throw "FAIL";
+ }();
+ }
+ expect_stdout: "PASS"
+}
+
+issues_3267_3: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ dead_code: true,
+ evaluate: true,
+ inline: true,
+ keep_fargs: false,
+ passes: 2,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ (function(x) {
+ x();
+ })(function() {
+ (function(i) {
+ if (i)
+ return console.log("PASS");
+ throw "FAIL";
+ })(Object());
+ });
+ }
+ expect: {
+ console.log("PASS");
+ }
+ expect_stdout: "PASS"
+}