@Override
  public void visitIfElse(IfStatement stat) {
    stat.setBooleanExpression((BooleanExpression)replaceExpr(stat.getBooleanExpression()));
    stat.setIfBlock(replace(stat.getIfBlock()));
    stat.setElseBlock(replace(stat.getElseBlock()));
  }
Groovy AST visitor that allows to replace both statements and expressions.

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