private CatchStatement createThrowableAssignmentAndRethrowCatchStatement(VariableExpression assignmentVar) {
    Parameter catchParameter = new Parameter(nodeCache.Throwable, SpockNames.SPOCK_TMP_THROWABLE);

    BinaryExpression assignThrowableExpr =
        new BinaryExpression(
            new VariableExpression(assignmentVar),
            Token.newSymbol(Types.ASSIGN, -1, -1),
            new VariableExpression(catchParameter));

    return new CatchStatement(catchParameter,
        new BlockStatement(
            asList(
              new ExpressionStatement(assignThrowableExpr),
              new ThrowStatement(new VariableExpression(catchParameter))),
          null));
  }
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