Skip to content

Commit 8d90018

Browse files
committed
Compare operators are excluded from the del_paren candidates in visit_Operator().
1 parent 4cf11b2 commit 8d90018

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyverilog/ast_code_generator/codegen.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,15 @@ def visit_Operator(self, node):
460460
left = self.visit(node.left)
461461
right = self.visit(node.right)
462462
if ( isinstance(node.left, (Identifier, Value)) or
463-
((not isinstance(node.left, (Sll, Srl, Sra))) and
463+
((not isinstance(node.left, (Sll, Srl, Sra,
464+
LessThan, GreaterThan, LessEq, GreaterEq,
465+
Eq, NotEq, Eql, NotEql))) and
464466
(lorder is not None and lorder <= order)) ):
465467
left = del_paren(left)
466468
if ( isinstance(node.right, (Identifier, Value)) or
467-
((not isinstance(node.right, (Sll, Srl, Sra))) and
469+
((not isinstance(node.right, (Sll, Srl, Sra,
470+
LessThan, GreaterThan, LessEq, GreaterEq,
471+
Eq, NotEq, Eql, NotEql))) and
468472
(rorder is not None and order > rorder)) ):
469473
right = del_paren(right)
470474
template_dict = {

0 commit comments

Comments
 (0)