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 2020/06/26 03:52:32 UTC

[groovy] branch danielsun/refactor-20200626 created (now 98bdc0e)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch danielsun/refactor-20200626
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 98bdc0e  Trivial refactoring: remove duplicated code

This branch includes the following new commits:

     new 98bdc0e  Trivial refactoring: remove duplicated code

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: Trivial refactoring: remove duplicated code

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/refactor-20200626
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 98bdc0e2bf9655f072662cc57973dfd29d7a850f
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Jun 26 11:51:56 2020 +0800

    Trivial refactoring: remove duplicated code
---
 .../java/org/apache/groovy/parser/antlr4/AstBuilder.java  | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 6ce6000..e3f2f29 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2472,20 +2472,13 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> {
             }
 
             // e.g.  m { return 1; }
-            Expression thisExpr = new VariableExpression("this");
-            configureAST(thisExpr, baseExpr);
-
             MethodCallExpression methodCallExpression =
-                    new MethodCallExpression(
-                            thisExpr,
-
-                            (baseExpr instanceof VariableExpression)
-                                    ? this.createConstantExpression(baseExpr)
-                                    : baseExpr,
-
+                    createMethodCallExpression(
+                            baseExpr,
                             configureAST(
                                     new ArgumentListExpression(closureExpression),
-                                    closureExpression)
+                                    closureExpression
+                            )
                     );
 
             return configureAST(methodCallExpression, ctx);