Index: src/main/org/codehaus/groovy/control/SourceUnit.java =================================================================== --- src/main/org/codehaus/groovy/control/SourceUnit.java (revision 22131) +++ src/main/org/codehaus/groovy/control/SourceUnit.java (working copy) @@ -274,6 +274,10 @@ this.ast.setDescription(this.name); } catch (SyntaxException e) { + if (this.ast==null) { + // Create a dummy ModuleNode to represent a failed parse - in case a later phase attempts to use the ast + this.ast = new ModuleNode(this); + } getErrorCollector().addError(new SyntaxErrorMessage(e, this)); }