private IfStatement ifThrowableIsNotNull(Statement statement) {
    return new IfStatement(
      // if ($spock_feature_throwable != null)
      new BooleanExpression(AstUtil.createVariableIsNotNullExpression(new VariableExpression(SpockNames.SPOCK_FEATURE_THROWABLE, nodeCache.Throwable))),
      statement,
      EmptyStatement.INSTANCE
    );
  }
A Spec visitor responsible for most of the rewriting of a Spec's AST.

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