aboutsummaryrefslogtreecommitdiff
path: root/test/compress/drop-unused.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/drop-unused.js')
-rw-r--r--test/compress/drop-unused.js80
1 files changed, 80 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 33241d67..eb6f9df4 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1299,3 +1299,83 @@ issue_2288: {
}
}
}
+
+issue_2516_1: {
+ options = {
+ collapse_vars: true,
+ reduce_funcs: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ function foo() {
+ function qux(x) {
+ bar.call(null, x);
+ }
+ function bar(x) {
+ var FOUR = 4;
+ var trouble = x || never_called();
+ var value = (FOUR - 1) * trouble;
+ console.log(value == 6 ? "PASS" : value);
+ }
+ Baz = qux;
+ }
+ var Baz;
+ foo();
+ Baz(2);
+ }
+ expect: {
+ function foo() {
+ Baz = function(x) {
+ (function(x) {
+ var trouble = x || never_called();
+ var value = (4 - 1) * trouble;
+ console.log(6 == value ? "PASS" : value);
+ }).call(null, x);
+ };
+ }
+ var Baz;
+ foo();
+ Baz(2);
+ }
+}
+
+issue_2516_2: {
+ options = {
+ collapse_vars: true,
+ reduce_funcs: true,
+ reduce_vars: true,
+ passes: 2,
+ unused: true,
+ }
+ input: {
+ function foo() {
+ function qux(x) {
+ bar.call(null, x);
+ }
+ function bar(x) {
+ var FOUR = 4;
+ var trouble = x || never_called();
+ var value = (FOUR - 1) * trouble;
+ console.log(value == 6 ? "PASS" : value);
+ }
+ Baz = qux;
+ }
+ var Baz;
+ foo();
+ Baz(2);
+ }
+ expect: {
+ function foo() {
+ Baz = function(x) {
+ (function(x) {
+ var value = (4 - 1) * (x || never_called());
+ console.log(6 == value ? "PASS" : value);
+ }).call(null, x);
+ };
+ }
+ var Baz;
+ foo();
+ Baz(2);
+ }
+}