@Override
  public void visitBinaryExpression(BinaryExpression expr) {
    // order of convert calls is important or indexes and thus recorded values get confused
    Expression convertedLeftExpression = Types.ofType(expr.getOperation().getType(), Types.ASSIGNMENT_OPERATOR) ?
      // prevent lvalue from getting turned into record(lvalue), which can no longer be assigned to
      convertAndRecordNa(expr.getLeftExpression()) :
      convert(expr.getLeftExpression());
    Expression convertedRightExpression = convert(expr.getRightExpression());

    Expression conversion =
      Types.ofType(expr.getOperation().getType(), Types.KEYWORD_INSTANCEOF) ?
        // morph instanceof expression to isInstance method call to be able to record rvalue
        createDirectMethodCall(convertedRightExpression, resources.getAstNodeCache().Class_IsInstance, convertedLeftExpression) :
        new BinaryExpression(convertedLeftExpression, expr.getOperation(), convertedRightExpression);

    if (isSpecialCollectionCondition(conversion)) {
      conversion = transformSpecialCollectionCondition(conversion);
    }

    conversion.setSourcePosition(expr);
    result = record(conversion);
  }
Rewrites explicit ("assert x > 3") and implicit ("x > 3") condition
statements. Replacing the original statement with the rewritten one is up
to clients.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/compiler/ConditionRewriter.java