aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-01-04 01:03:33 +0800
committerGitHub <noreply@github.com>2018-01-04 01:03:33 +0800
commitcfe3a98ce50a1eb844654da57b4ef47a750feda5 (patch)
tree7c15b516108c4eda8a4e1836d059c7d54c8e9e15 /test/compress/reduce_vars.js
parent14778e049b12e131fc05ddacff9cda56dfede77d (diff)
downloadtracifyjs-cfe3a98ce50a1eb844654da57b4ef47a750feda5.tar.gz
tracifyjs-cfe3a98ce50a1eb844654da57b4ef47a750feda5.zip
drop `unused` assignment based on `reduce_vars` (#2709)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index e370e5be..3d993b90 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -299,7 +299,7 @@ unsafe_evaluate_modified: {
console.log(function(){ var o={p:1}; o.p++; console.log(o.p); return o.p; }());
console.log(function(){ var o={p:2}; --o.p; console.log(o.p); return o.p; }());
console.log(function(){ var o={p:3}; o.p += ""; console.log(o.p); return o.p; }());
- console.log(function(){ var o={p:4}; o = {}; console.log(o.p); return o.p; }());
+ console.log(function(){ var o; o = {}; console.log(o.p); return o.p; }());
console.log(function(){ var o={p:5}; o.p = -9; console.log(o.p); return o.p; }());
function inc() { this.p++; }
console.log(function(){ var o={p:6}; inc.call(o); console.log(o.p); return o.p; }());
@@ -5237,3 +5237,42 @@ defun_catch_6: {
}
expect_stdout: "42"
}
+
+duplicate_lambda_defun_name_1: {
+ options = {
+ reduce_vars: true,
+ }
+ input: {
+ console.log(function f(a) {
+ function f() {}
+ return f.length;
+ }());
+ }
+ expect: {
+ console.log(function f(a) {
+ function f() {}
+ return f.length;
+ }());
+ }
+ expect_stdout: "0"
+}
+
+duplicate_lambda_defun_name_2: {
+ options = {
+ passes: 2,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ console.log(function f(a) {
+ function f() {}
+ return f.length;
+ }());
+ }
+ expect: {
+ console.log(function(a) {
+ return function() {}.length;
+ }());
+ }
+ expect_stdout: "0"
+}