@Override
  @SuppressWarnings("unchecked")
  public void visitSwitch(SwitchStatement stat) {
    stat.setExpression(replaceExpr(stat.getExpression()));
    replaceAll(stat.getCaseStatements());
    stat.setDefaultStatement(replace(stat.getDefaultStatement()));
  }
Groovy AST visitor that allows to replace both statements and expressions.

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