You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/02/24 16:50:17 UTC
[groovy] branch GROOVY_4_0_X updated: GROOVY-5726: use `createCallMethodCallExpression` for command expression
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
new 4475dd9 GROOVY-5726: use `createCallMethodCallExpression` for command expression
4475dd9 is described below
commit 4475dd94b68842af1d121e4cc1746a227125e0c2
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Feb 24 10:36:37 2022 -0600
GROOVY-5726: use `createCallMethodCallExpression` for command expression
- partial restore of previous condition
---
.../org/apache/groovy/parser/antlr4/AstBuilder.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index f88c609..35d2b8f 100644
--- a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2566,16 +2566,16 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> {
throw new GroovyBugError("When baseExpr is a instance of MethodCallExpression, which should follow NO argumentList");
}
methodCallExpression = (MethodCallExpression) baseExpr;
- } else {
- if (!isInsideParentheses(baseExpr)
- && (baseExpr instanceof VariableExpression /* e.g. m 1, 2 */
- || baseExpr instanceof GStringExpression /* e.g. "$m" 1, 2 */
- || (baseExpr instanceof ConstantExpression && isTrue(baseExpr, IS_STRING)) /* e.g. "m" 1, 2 */)) {
- validateInvalidMethodDefinition(baseExpr, arguments);
- } else {
- // e.g. a[x] b, new A() b, etc.
- }
+
+ } else if (!isInsideParentheses(baseExpr)
+ && (baseExpr instanceof VariableExpression // e.g. m 1, 2
+ || baseExpr instanceof GStringExpression // e.g. "$m" 1, 2
+ || (baseExpr instanceof ConstantExpression && isTrue(baseExpr, IS_STRING)))) { // e.g. "m" 1, 2
+ validateInvalidMethodDefinition(baseExpr, arguments);
+
methodCallExpression = configureAST(this.createMethodCallExpression(baseExpr, arguments), ctx.expression(), arguments);
+ } else { // e.g. a[x] b, new A() b, etc.
+ methodCallExpression = configureAST(this.createCallMethodCallExpression(baseExpr, arguments), ctx.expression(), arguments);
}
methodCallExpression.putNodeMetaData(IS_COMMAND_EXPRESSION, Boolean.TRUE);