@Override
  public void visitPropertyExpression(PropertyExpression expr) {
    PropertyExpression result = new PropertyExpression(
        replaceExpr(expr.getObjectExpression()),
        replaceExpr(expr.getProperty()),
        expr.isSafe()
    );
    result.setSpreadSafe(expr.isSpreadSafe());
    result.setStatic(expr.isStatic());
    result.setImplicitThis(expr.isImplicitThis());
    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