groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Minor refactoring: simplify creating class node via qualified class name
Date Thu, 19 Jan 2017 01:21:43 GMT
Repository: groovy
Updated Branches:
  refs/heads/parrot 30d6db060 -> 1cb1260f3


Minor refactoring: simplify creating class node via qualified class name


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1cb1260f
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1cb1260f
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1cb1260f

Branch: refs/heads/parrot
Commit: 1cb1260f302e31bb799b3cdc6359b77b139ee2b1
Parents: 30d6db0
Author: sunlan <sunlan@apache.org>
Authored: Thu Jan 19 09:21:17 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Jan 19 09:21:17 2017 +0800

----------------------------------------------------------------------
 .../apache/groovy/parser/antlr4/AstBuilder.java | 35 ++------------------
 1 file changed, 2 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/1cb1260f/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index b2f0a54..84c5d77 100644
--- a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -134,7 +134,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -3497,21 +3496,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
 
     @Override
     public ClassNode visitQualifiedClassName(QualifiedClassNameContext ctx) {
-        String className = this.visitIdentifier(ctx.identifier());
-
-        ClassNode result;
-        if (asBoolean(ctx.qualifiedNameElement())) {
-            result =
-                    ClassHelper.make(
-                            ctx.qualifiedNameElement().stream()
-                                    .map(ParseTree::getText)
-                                    .collect(Collectors.joining(DOT_STR))
-                                    + DOT_STR
-                                    + className
-                    );
-        } else {
-            result = ClassHelper.make(className);
-        }
+        ClassNode result = ClassHelper.make(ctx.getText());
 
         /*
         if (!isTrue(ctx, IS_INSIDE_INSTANCEOF_EXPR)) { // type in the "instanceof" expression
should not have proxy to redirect to it
@@ -3524,23 +3509,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
 
     @Override
     public ClassNode visitQualifiedStandardClassName(QualifiedStandardClassNameContext ctx)
{
-        String className =
-                ctx.className().stream()
-                        .map(this::visitClassName)
-                        .collect(Collectors.joining(DOT_STR));
-
-        ClassNode result;
-        if (asBoolean(ctx.qualifiedNameElement())) {
-            result = ClassHelper.make(
-                    ctx.qualifiedNameElement().stream()
-                            .map(ParseTree::getText)
-                            .collect(Collectors.joining(DOT_STR))
-                            + DOT_STR
-                            + className
-            );
-        } else {
-            result = ClassHelper.make(className);
-        }
+        ClassNode result = ClassHelper.make(ctx.getText());
 
         if (!isTrue(ctx, IS_INSIDE_INSTANCEOF_EXPR)) { // type in the "instanceof" expression
should not have proxy to redirect to it
             result = this.proxyClassNode(result);


Mime
View raw message