@SuppressWarnings("unchecked")
  protected <T extends Expression> void replaceAllExprs(List<T> exprs) {
    ListIterator<T> iter = exprs.listIterator();
    while (iter.hasNext())
      iter.set((T) replaceExpr(iter.next()));
  }
Groovy AST visitor that allows to replace both statements and expressions.

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