Permalink
Browse files

Fix rspivak#21

Removal of necessary parentheses
  • Loading branch information...
rspivak committed Feb 4, 2012
1 parent 08db93c commit 0f446fd6b1a0b789ce2f4fc0c0a334b6c356d3e0
Showing with 10 additions and 1 deletion.
  1. +1 −0 CREDIT
  2. +5 −0 src/slimit/tests/test_minifier.py
  3. +4 −1 src/slimit/visitors/minvisitor.py
View
1 CREDIT
@@ -12,3 +12,4 @@ Bug reports
- BadKnees https://github.com/BadKnees
- Waldemar Kornewald
- Michał Bartoszkiewicz https://github.com/embe
- Hasan Yasin Öztürk https://github.com/hasanyasin
@@ -357,6 +357,11 @@ def assertMinified(self, source, expected):
("""foo["bar'"]=42;""", """foo["bar'"]=42;"""),
('foo["bar bar"];', 'foo["bar bar"];'),
('foo["bar"+"bar"];', 'foo["bar"+"bar"];'),
# https://github.com/rspivak/slimit/issues/21
# c||(c=393,a=323,b=2321); --> c||c=393,a=323,b=2321; ERROR
('c||(c=393);', 'c||(c=393);'),
('c||(c=393,a=323,b=2321);', 'c||(c=393,a=323,b=2321);'),
]
@@ -83,7 +83,10 @@ def visit_Number(self, node):
return node.value
def visit_Comma(self, node):
return '%s,%s' % (self.visit(node.left), self.visit(node.right))
template = '%s,%s'
if getattr(node, '_parens', False):
template = '(%s)' % template
return template % (self.visit(node.left), self.visit(node.right))
def visit_EmptyStatement(self, node):
return node.value

0 comments on commit 0f446fd

Please sign in to comment.