void processSpec(SourceUnit sourceUnit, ClassNode clazz, ErrorReporter errorReporter, SourceLookup sourceLookup) {
      try {
        Spec spec = new SpecParser(errorReporter).build(clazz);
        spec.accept(new SpecRewriter(nodeCache, sourceLookup, errorReporter));
        spec.accept(new SpecAnnotator(nodeCache));
        // if there were no errors so far, let the variable scope visitor fix up variable scopes
        if (!sourceUnit.getErrorCollector().hasErrors()) {
          new VariableScopeVisitor(sourceUnit).visitClass(clazz);
        }
      } catch (Exception e) {
        errorReporter.error(
            "Unexpected error during compilation of spec '%s'. Maybe you have used invalid Spock syntax? Anyway, please file a bug report at https://issues.spockframework.org.",
            e, clazz.getName());
      }
    }
AST transformation for rewriting Spock specifications. Runs after phase
SEMANTIC_ANALYSIS, which means that the AST is semantically accurate
and already decorated with reflection information. On the flip side,
because types and variables have already been resolved,
program elements like import statements and variable definitions
can no longer be manipulated at will.

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