aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2016-01-05 13:56:52 +0200
committerMihai Bazon <mihai.bazon@gmail.com>2016-01-05 13:56:52 +0200
commitfe4e9f9d97dcc6594a8fc49e04630aa619ff1866 (patch)
tree9f2ede884eade57300136f8a7d965f28db787fc7 /test
parent174404c0f37bf14aff23c41889e6bab1fd87c1d7 (diff)
downloadtracifyjs-fe4e9f9d97dcc6594a8fc49e04630aa619ff1866.tar.gz
tracifyjs-fe4e9f9d97dcc6594a8fc49e04630aa619ff1866.zip
Fix hoisting the var in ForIn
Close #913
Diffstat (limited to 'test')
-rw-r--r--test/compress/issue-913.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/compress/issue-913.js b/test/compress/issue-913.js
new file mode 100644
index 00000000..9d34d9d9
--- /dev/null
+++ b/test/compress/issue-913.js
@@ -0,0 +1,20 @@
+keep_var_for_in: {
+ options = {
+ hoist_vars: true,
+ unused: true
+ };
+ input: {
+ (function(obj){
+ var foo = 5;
+ for (var i in obj)
+ return foo;
+ })();
+ }
+ expect: {
+ (function(obj){
+ var i, foo = 5;
+ for (i in obj)
+ return foo;
+ })();
+ }
+}