aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-26 19:14:30 +0800
committerGitHub <noreply@github.com>2017-03-26 19:14:30 +0800
commit861a79ac9fdb2cdbb54054306eb896e2c134af73 (patch)
tree45fab27f3d43aad6001f02803ac008c74fc8e11f /test/compress/reduce_vars.js
parent00996afd2ce1f05fa973016e793495f69b524d5b (diff)
downloadtracifyjs-861a79ac9fdb2cdbb54054306eb896e2c134af73.tar.gz
tracifyjs-861a79ac9fdb2cdbb54054306eb896e2c134af73.zip
fix `delete` related issues in `collapse_vars` and `reduce_vars` (#1689)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js27
1 files changed, 27 insertions, 0 deletions
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
+}