@Override
  public void visitRangeExpression(RangeExpression expr) {
    RangeExpression result = new RangeExpression(
        replaceExpr(expr.getFrom()),
        replaceExpr(expr.getTo()),
        expr.isInclusive()
    );
    result.setType(expr.getType());
    result.setSourcePosition(expr);
    replaceVisitedExpressionWith(result);
  }
Groovy AST visitor that allows to replace both statements and expressions.

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