public Statement replace(Statement stat) {
    replacement = null;
    stat.visit(this);
    Statement result = replacement == null ? stat : replacement;
    replacement = null;
    return result;
  }
Visits the specified statement. If the statement's visit method calls
replaceVisitedMethodWith(), the statement will be replaced.
spock-core/src/main/java/org/spockframework/compiler/StatementReplacingVisitorSupport.java