aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js3
-rw-r--r--test/compress/reduce_vars.js27
2 files changed, 29 insertions, 1 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 2437ca5f..4107707b 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -894,7 +894,8 @@ collapse_vars_unary: {
}
expect: {
function f0(o, p) {
- delete o[p];
+ var x = o[p];
+ delete x;
}
function f1(n) {
return n > +!!n
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 943dd290..f4dd68d2 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -1544,3 +1544,30 @@ issue_1670_6: {
}
expect_stdout: "1"
}
+
+unary_delete: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ var b = 10;
+ function f() {
+ var a;
+ if (delete a) b--;
+ }
+ f();
+ console.log(b);
+ }
+ expect: {
+ var b = 10;
+ function f() {
+ var a;
+ if (delete a) b--;
+ }
+ f();
+ console.log(b);
+ }
+ expect_stdout: true
+}