groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [3/3] groovy git commit: Minor refactoring
Date Thu, 30 Nov 2017 07:10:25 GMT
Minor refactoring

(cherry picked from commit 00b564e)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 61816c4d4d1527a20f59fe88e87e91eb722eb137
Parents: 41c2a06
Author: sunlan <sunlan@apache.org>
Authored: Thu Nov 30 14:59:12 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Nov 30 15:09:54 2017 +0800

----------------------------------------------------------------------
 .../groovy/classgen/InnerClassCompletionVisitor.java    | 11 -----------
 .../org/codehaus/groovy/classgen/InnerClassVisitor.java | 12 ------------
 .../groovy/classgen/InnerClassVisitorHelper.java        | 12 ++++++++++++
 3 files changed, 12 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/61816c4d/src/main/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java b/src/main/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java
index b03d6fd..a8d84c8 100644
--- a/src/main/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java
+++ b/src/main/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java
@@ -356,17 +356,6 @@ public class InnerClassCompletionVisitor extends InnerClassVisitorHelper
impleme
         }
     }
 
-    private static boolean shouldHandleImplicitThisForInnerClass(ClassNode cn) {
-        if (cn.isEnum() || cn.isInterface()) return false;
-        if ((cn.getModifiers() & Opcodes.ACC_STATIC) != 0) return false;
-        if (!(cn instanceof InnerClassNode)) return false;
-        InnerClassNode innerClass = (InnerClassNode) cn;
-        // scope != null means aic, we don't handle that here
-        if (innerClass.getVariableScope() != null) return false;
-        // static inner classes don't need this$0
-        return (innerClass.getModifiers() & ACC_STATIC) == 0;
-    }
-
     private void addThisReference(ConstructorNode node) {
         if (!shouldHandleImplicitThisForInnerClass(classNode)) return;
         Statement code = node.getCode();

http://git-wip-us.apache.org/repos/asf/groovy/blob/61816c4d/src/main/org/codehaus/groovy/classgen/InnerClassVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/InnerClassVisitor.java b/src/main/org/codehaus/groovy/classgen/InnerClassVisitor.java
index a235f86..87815a8 100644
--- a/src/main/org/codehaus/groovy/classgen/InnerClassVisitor.java
+++ b/src/main/org/codehaus/groovy/classgen/InnerClassVisitor.java
@@ -100,18 +100,6 @@ public class InnerClassVisitor extends InnerClassVisitorHelper implements
Opcode
         processingObjInitStatements = false;
     }
 
-    private static boolean shouldHandleImplicitThisForInnerClass(ClassNode cn) {
-        if (cn.isEnum() || cn.isInterface()) return false;
-        if ((cn.getModifiers() & Opcodes.ACC_STATIC) != 0) return false;
-
-        if (!(cn instanceof InnerClassNode)) return false;
-        InnerClassNode innerClass = (InnerClassNode) cn;
-        // scope != null means aic, we don't handle that here
-        if (innerClass.getVariableScope() != null) return false;
-        // static inner classes don't need this$0
-        return (innerClass.getModifiers() & ACC_STATIC) == 0;
-    }
-
     @Override
     protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) {
         this.currentMethod = node;

http://git-wip-us.apache.org/repos/asf/groovy/blob/61816c4d/src/main/org/codehaus/groovy/classgen/InnerClassVisitorHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/InnerClassVisitorHelper.java b/src/main/org/codehaus/groovy/classgen/InnerClassVisitorHelper.java
index 8cbe6cc..7ed0629 100644
--- a/src/main/org/codehaus/groovy/classgen/InnerClassVisitorHelper.java
+++ b/src/main/org/codehaus/groovy/classgen/InnerClassVisitorHelper.java
@@ -128,4 +128,16 @@ public abstract class InnerClassVisitorHelper extends ClassCodeVisitorSupport
{
                 new BinaryExpression(fe, Token.newSymbol(Types.ASSIGN, -1, -1), ve)
         ));
     }
+
+    protected static boolean shouldHandleImplicitThisForInnerClass(ClassNode cn) {
+        if (cn.isEnum() || cn.isInterface()) return false;
+        if ((cn.getModifiers() & Opcodes.ACC_STATIC) != 0) return false;
+
+        if (!(cn instanceof InnerClassNode)) return false;
+        InnerClassNode innerClass = (InnerClassNode) cn;
+        // scope != null means aic, we don't handle that here
+        if (innerClass.getVariableScope() != null) return false;
+        // static inner classes don't need this$0
+        return (innerClass.getModifiers() & Opcodes.ACC_STATIC) == 0;
+    }
 }


Mime
View raw message