Permalink
Browse files

Fix issue #37 also in the minifier visitor

  • Loading branch information...
1 parent 220eec8 commit 19389e0eca99a98157f1fbb3e8a0d4ceebe40055 Lele Gaifax committed Oct 3, 2012
Showing with 5 additions and 1 deletion.
  1. +3 −0 src/slimit/tests/test_minifier.py
  2. +2 −1 src/slimit/visitors/minvisitor.py
@@ -391,6 +391,9 @@ def assertMinified(self, source, expected):
# unary decrement operator in FOR init
('for(i--; i < 3; i++) {}', 'for(i--;i<3;i++){}'),
+ # issue-37, simple identifier in FOR init
+ ('for(i; i < 3; i++) {}', 'for(i;i<3;i++){}'),
+
# https://github.com/rspivak/slimit/issues/32
("""
Name.prototype = {
@@ -163,7 +163,8 @@ def visit_For(self, node):
if node.init is None:
s += ';'
elif isinstance(node.init, (ast.Assign, ast.Comma, ast.Conditional,
- ast.FunctionCall, ast.UnaryOp)):
+ ast.FunctionCall, ast.UnaryOp,
+ ast.Identifier)):
s += ';'
else:
s += ''

0 comments on commit 19389e0

Please sign in to comment.