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/07/24 12:49:50 UTC

[groovy] branch danielsun/tweak-mce-text created (now cc66180)

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

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


      at cc66180  Tweak text of `MethodCallExpression`

This branch includes the following new commits:

     new cc66180  Tweak text of `MethodCallExpression`

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: Tweak text of `MethodCallExpression`

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

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

commit cc661806ee109f1d744fbab5b47b8d5077eba3e9
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Jul 24 20:49:35 2021 +0800

    Tweak text of `MethodCallExpression`
---
 src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java b/src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java
index 1eef39e..a0eddee 100644
--- a/src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java
+++ b/src/main/java/org/codehaus/groovy/ast/expr/MethodCallExpression.java
@@ -142,7 +142,8 @@ public class MethodCallExpression extends Expression implements MethodCall {
         String args = arguments.getText();
         String spread = spreadSafe ? "*" : "";
         String dereference = safe ? "?" : "";
-        return object + spread + dereference + "." + meth + args;
+
+        return (implicitThis && "this".equals(object) ? "" : object + spread + dereference + ".") + meth + args;
     }
 
     /**