groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] branch master updated: Trivial refactoring: Remove duplicated branch in `switch` statement
Date Fri, 05 Apr 2019 18:41:02 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 336baf0  Trivial refactoring: Remove duplicated branch in `switch` statement
336baf0 is described below

commit 336baf0e791223b2be631030c59bf49cd85b2220
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sat Apr 6 02:39:06 2019 +0800

    Trivial refactoring: Remove duplicated branch in `switch` statement
---
 src/main/java/org/codehaus/groovy/syntax/Types.java | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/syntax/Types.java b/src/main/java/org/codehaus/groovy/syntax/Types.java
index 3415bd3..91a98d1 100644
--- a/src/main/java/org/codehaus/groovy/syntax/Types.java
+++ b/src/main/java/org/codehaus/groovy/syntax/Types.java
@@ -506,6 +506,8 @@ public class Types {
                 return specific >= NEWLINE && specific <= PIPE;
 
             case LITERAL:
+
+            case LITERAL_EXPRESSION:
                 return specific >= STRING && specific <= DECIMAL_NUMBER;
 
             case NUMBER:
@@ -526,6 +528,8 @@ public class Types {
                 return specific == KEYWORD_TRUE || specific == KEYWORD_FALSE;
 
             case TYPE_NAME:
+
+            case CREATABLE_TYPE_NAME:
                 if (specific == IDENTIFIER) {
                     return true;
                 }
@@ -535,12 +539,7 @@ public class Types {
             case PRIMITIVE_TYPE:
                 return specific >= KEYWORD_VOID && specific <= KEYWORD_CHAR;
 
-            case CREATABLE_TYPE_NAME:
-                if (specific == IDENTIFIER) {
-                    return true;
-                }
-
-                /* FALL THROUGH */
+            /* FALL THROUGH */
 
             case CREATABLE_PRIMITIVE_TYPE:
                 return specific >= KEYWORD_BOOLEAN && specific <= KEYWORD_CHAR;
@@ -726,9 +725,6 @@ public class Types {
                 }
                 break;
 
-            case LITERAL_EXPRESSION:
-                return specific >= STRING && specific <= DECIMAL_NUMBER;
-
             case ARRAY_EXPRESSION:
                 return specific == LEFT_SQUARE_BRACKET;
 
@@ -828,6 +824,8 @@ public class Types {
             case SYNTH_MIXIN:
             case SYNTH_METHOD:
             case SYNTH_PROPERTY:
+
+            case SYNTH_VARIABLE_DECLARATION:
                 return actual == IDENTIFIER;
 
             case SYNTH_LIST:
@@ -843,9 +841,6 @@ public class Types {
 
             case SYNTH_LABEL:
                 return actual == COLON;
-
-            case SYNTH_VARIABLE_DECLARATION:
-                return actual == IDENTIFIER;
         }
 
         return false;


Mime
View raw message