Skip to content

Commit

Permalink
Fix issue #37, handle simple identifier in FOR init
Browse files Browse the repository at this point in the history
  • Loading branch information
Lele Gaifax committed Oct 3, 2012
1 parent f9b8b22 commit 220eec8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES
@@ -1,5 +1,8 @@
Change History
==============
0.7.x (unreleased)
- Bug fix (simple identifier in FOR init): https://github.com/rspivak/slimit/issues/37

0.7.4 (2012-06-5)
------------------
- Bug fix: https://github.com/rspivak/slimit/issues/34
Expand Down
12 changes: 12 additions & 0 deletions src/slimit/tests/test_parser.py
Expand Up @@ -193,6 +193,18 @@ class ASITestCase(unittest.TestCase):
"""
for ( ; i < length; i++) {
}
"""),

("""
var i;
for (i; i < length; i++) {
}
""",
"""
var i;
for (i; i < length; i++) {
}
"""),
]
Expand Down
2 changes: 1 addition & 1 deletion src/slimit/visitors/ecmavisitor.py
Expand Up @@ -138,7 +138,7 @@ def visit_For(self, node):
if node.init is None:
s += ' ; '
elif isinstance(node.init, (ast.Assign, ast.Comma, ast.FunctionCall,
ast.UnaryOp)):
ast.UnaryOp, ast.Identifier)):
s += '; '
else:
s += ' '
Expand Down

0 comments on commit 220eec8

Please sign in to comment.