aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-44.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-11-12 13:23:57 +0200
committerMihai Bazon <mihai@bazon.net>2012-11-12 13:23:57 +0200
commit53355bdb24dc4ba31112239380209fc0caa7c897 (patch)
tree68ffca7482d56250d344c2c4d2900a28d9cbdce4 /test/compress/issue-44.js
parentf05c99d89f0ccd18c757adfd6fa7cc93092823b5 (diff)
downloadtracifyjs-53355bdb24dc4ba31112239380209fc0caa7c897.tar.gz
tracifyjs-53355bdb24dc4ba31112239380209fc0caa7c897.zip
fix invalid AST produced by dropping unused variable
close #44
Diffstat (limited to 'test/compress/issue-44.js')
-rw-r--r--test/compress/issue-44.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/issue-44.js b/test/compress/issue-44.js
new file mode 100644
index 00000000..7a972f9e
--- /dev/null
+++ b/test/compress/issue-44.js
@@ -0,0 +1,31 @@
+issue_44_valid_ast_1: {
+ options = { unused: true };
+ input: {
+ function a(b) {
+ for (var i = 0, e = b.qoo(); ; i++) {}
+ }
+ }
+ expect: {
+ function a(b) {
+ var i = 0;
+ for (b.qoo(); ; i++);
+ }
+ }
+}
+
+issue_44_valid_ast_2: {
+ options = { unused: true };
+ input: {
+ function a(b) {
+ if (foo) for (var i = 0, e = b.qoo(); ; i++) {}
+ }
+ }
+ expect: {
+ function a(b) {
+ if (foo) {
+ var i = 0;
+ for (b.qoo(); ; i++);
+ }
+ }
+ }
+}