Exemple #1
0
 def visit_comparison_expr(self, expr: ComparisonExpr) -> Expression:
     results = []
     for index in range(len(expr.operators)):
         left, right = expr.operands[index], expr.operands[index + 1]
         operator = expr.operators[index]
         opExpr = OpExpr(operator, left, right)
         result = opExpr.accept(self)
         results.append(result)
     # Do the and of all comparisons
     for r in results:
         if not isinstance(r, IntExpr):
             raise Exception
         if r.value == 0:
             return IntExpr(0)
     return IntExpr(1)