aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/collapse_vars.js12
-rw-r--r--test/compress/drop-unused.js2
-rw-r--r--test/compress/functions.js56
3 files changed, 60 insertions, 10 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 6e0afc6e..1862687a 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -3497,10 +3497,10 @@ issue_2437_1: {
return Object.defineProperty(XMLHttpRequest.prototype, "onreadystatechange", xhrDesc || {}),
result;
}
- var req, detectFunc = function(){};
- (req = new XMLHttpRequest()).onreadystatechange = detectFunc;
- result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc;
- return req.onreadystatechange = null, result;
+ var req = new XMLHttpRequest(), detectFunc = function(){};
+ return req.onreadystatechange = detectFunc,
+ result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc,
+ req.onreadystatechange = null, result;
}());
}
}
@@ -3545,8 +3545,8 @@ issue_2437_2: {
if (xhrDesc)
return (req = new XMLHttpRequest()).onreadystatechange,
Object.defineProperty(XMLHttpRequest.prototype, "onreadystatechange", xhrDesc || {});
- var req;
- (req = new XMLHttpRequest).onreadystatechange = function(){},
+ var req = new XMLHttpRequest();
+ req.onreadystatechange = function(){},
req[SYMBOL_FAKE_ONREADYSTATECHANGE_1],
req.onreadystatechange = null;
}();
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 9286532b..0869749d 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -797,6 +797,7 @@ assign_chain: {
issue_1583: {
options = {
keep_fargs: true,
+ passes: 2,
reduce_funcs: true,
reduce_vars: true,
unused: true,
@@ -1144,6 +1145,7 @@ var_catch_toplevel: {
options = {
conditionals: true,
negate_iife: true,
+ passes: 2,
reduce_funcs: true,
reduce_vars: true,
side_effects: true,
diff --git a/test/compress/functions.js b/test/compress/functions.js
index e12ce3e2..21146457 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -2860,10 +2860,10 @@ issue_2437: {
result;
}
function detectFunc() {}
- var req;
- (req = new XMLHttpRequest()).onreadystatechange = detectFunc;
- result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc;
- return req.onreadystatechange = null, result;
+ var req = new XMLHttpRequest();
+ return req.onreadystatechange = detectFunc,
+ result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc,
+ req.onreadystatechange = null, result;
}());
}
}
@@ -3065,3 +3065,51 @@ class_iife: {
}
expect_stdout: "PASS"
}
+
+issue_3400: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ reduce_funcs: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function(f) {
+ console.log(f()()[0].p);
+ })(function() {
+ function g() {
+ function h(u) {
+ var o = {
+ p: u
+ };
+ return console.log(o[g]), o;
+ }
+ function e() {
+ return [ 42 ].map(function(v) {
+ return h(v);
+ });
+ }
+ return e();
+ }
+ return g;
+ });
+ }
+ expect: {
+ void console.log(function g() {
+ function e() {
+ return [42].map(function(v) {
+ return o = {
+ p: v
+ }, console.log(o[g]) , o;
+ var o;
+ });
+ }
+ return e();
+ }()[0].p);
+ }
+ expect_stdout: [
+ "undefined",
+ "42",
+ ]
+}