You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/08/20 15:59:59 UTC
[groovy] 01/02: Format code
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 73c3e0f1c9e499049b8d4d9358be61ca371351f9
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Aug 20 23:57:08 2021 +0800
Format code
---
.../java/org/codehaus/groovy/control/SourceUnit.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/SourceUnit.java b/src/main/java/org/codehaus/groovy/control/SourceUnit.java
index 2568d6b..360cb26 100644
--- a/src/main/java/org/codehaus/groovy/control/SourceUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/SourceUnit.java
@@ -245,16 +245,17 @@ public class SourceUnit extends ProcessingUnit {
* Builds the AST.
*/
public ModuleNode buildAST() {
- if (this.ast == null)
- try {
- this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst);
- this.ast.setDescription(this.name);
- } catch (SyntaxException e) {
- if (this.ast == null) {
- // create an empty ModuleNode to represent a failed parse, in case a later phase attempts to use the AST
- this.ast = new ModuleNode(this);
+ if (this.ast == null) {
+ try {
+ this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst);
+ this.ast.setDescription(this.name);
+ } catch (SyntaxException e) {
+ if (this.ast == null) {
+ // create an empty 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));
}
- getErrorCollector().addError(new SyntaxErrorMessage(e, this));
}
return this.ast;
}