aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js71
-rw-r--r--test/reduce.js5
2 files changed, 76 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 3feb0183..ae1a6e5b 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -3125,3 +3125,74 @@ issue_4413: {
}
expect_stdout: "0"
}
+
+issue_4464_1: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ var a = function() {};
+ return [ arguments, a ];
+ }
+ console.log(typeof f()[1]);
+ }
+ expect: {
+ function f(a) {
+ a = function() {};
+ return [ arguments, a ];
+ }
+ console.log(typeof f()[1]);
+ }
+ expect_stdout: "function"
+}
+
+issue_4464_2: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ var a = function() {};
+ return [ arguments, a ];
+ }
+ console.log(typeof f(42)[0][0]);
+ }
+ expect: {
+ function f(a) {
+ a = function() {};
+ return [ arguments, a ];
+ }
+ console.log(typeof f(42)[0][0]);
+ }
+ expect_stdout: "function"
+}
+
+issue_4464_3: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function a(a) {
+ var a = function() {};
+ return [ arguments[0], a ];
+ })(42).forEach(function(b) {
+ console.log(typeof b);
+ });
+ }
+ expect: {
+ (function(a) {
+ a = function() {};
+ return [ arguments[0], a ];
+ })(42).forEach(function(b) {
+ console.log(typeof b);
+ });
+ }
+ expect_stdout: [
+ "function",
+ "function",
+ ]
+}
diff --git a/test/reduce.js b/test/reduce.js
index f6b54141..48030b0f 100644
--- a/test/reduce.js
+++ b/test/reduce.js
@@ -352,6 +352,11 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
}
}
}
+ else if (node instanceof U.AST_Spread) {
+ node.start._permute++;
+ CHANGED = true;
+ return node.expression;
+ }
else if (node instanceof U.AST_Switch) {
var expr = [
node.expression, // switch expression