Skip to content

Commit 523364b

Browse files
committed
Add simple constant folding
1 parent 5b9ae1b commit 523364b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/python_minifier/transforms/constant_folding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def visit_BinOp(self, node):
1919
node.right = self.visit(node.right)
2020

2121
# Check this is a constant expression that could be folded
22-
if not is_ast_node(node.left, (ast.Num, ast.Str, ast.Bytes, ast.NameConstant)):
22+
if not is_ast_node(node.left, (ast.Num, ast.Str, 'Bytes', 'NameConstant')):
2323
return node
24-
if not is_ast_node(node.right, (ast.Num, ast.Str, ast.Bytes, ast.NameConstant)):
24+
if not is_ast_node(node.right, (ast.Num, ast.Str, 'Bytes', 'NameConstant')):
2525
return node
2626

2727
expression_printer = ExpressionPrinter()

0 commit comments

Comments
 (0)