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: rename method name
Date Sat, 21 Dec 2019 13:44:38 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 d399c9f  Trivial refactoring: rename method name
d399c9f is described below

commit d399c9f0112f54c891fe7a66764660d61cbb0451
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sat Dec 21 21:39:33 2019 +0800

    Trivial refactoring: rename method name
---
 .../org/codehaus/groovy/classgen/AsmClassGenerator.java    | 14 +++++++-------
 .../org/codehaus/groovy/classgen/asm/ClosureWriter.java    |  2 +-
 .../codehaus/groovy/classgen/asm/DelegatingController.java |  8 ++++----
 .../org/codehaus/groovy/classgen/asm/InvocationWriter.java |  2 +-
 .../org/codehaus/groovy/classgen/asm/WriterController.java |  8 ++++----
 .../groovy/classgen/asm/sc/StaticInvocationWriter.java     |  8 ++++----
 .../sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java |  4 ++--
 .../groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java  |  4 ++--
 8 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 2f73345..24ef1b8 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -1052,7 +1052,7 @@ public class AsmClassGenerator extends ClassGenerator {
                 if (isSuperExpression(objectExpression)) {
                     field = classNode.getSuperClass().getDeclaredField(name);
                     privateSuperField = (field != null && field.isPrivate());
-                } else if (expression.isImplicitThis() || !controller.isInClosure()) {
+                } else if (expression.isImplicitThis() || !controller.isInGeneratedFunction())
{
                     field = classNode.getDeclaredField(name);
 
                     ClassNode outer = classNode.getOuterClass();
@@ -1089,7 +1089,7 @@ public class AsmClassGenerator extends ClassGenerator {
 
         if (!visited) {
             boolean useMetaObjectProtocol = isGroovyObject(objectExpression)
-                    && (!isThisOrSuper(objectExpression) || !controller.isStaticContext()
|| controller.isInClosure());
+                    && (!isThisOrSuper(objectExpression) || !controller.isStaticContext()
|| controller.isInGeneratedFunction());
 
             MethodCallerMultiAdapter adapter;
             if (controller.getCompileStack().isLHS()) {
@@ -1171,7 +1171,7 @@ public class AsmClassGenerator extends ClassGenerator {
     public void loadStaticField(final FieldExpression fldExp) {
         MethodVisitor mv = controller.getMethodVisitor();
         FieldNode field = fldExp.getField();
-        boolean holder = field.isHolder() && !controller.isInClosureConstructor();
+        boolean holder = field.isHolder() && !controller.isInGeneratedFunctionConstructor();
         ClassNode type = field.getType();
 
         String ownerName = (field.getOwner().equals(controller.getClassNode()))
@@ -1193,7 +1193,7 @@ public class AsmClassGenerator extends ClassGenerator {
     public void loadInstanceField(final FieldExpression fldExp) {
         MethodVisitor mv = controller.getMethodVisitor();
         FieldNode field = fldExp.getField();
-        boolean holder = field.isHolder() && !controller.isInClosureConstructor();
+        boolean holder = field.isHolder() && !controller.isInGeneratedFunctionConstructor();
         ClassNode type = field.getType();
         String ownerName = (field.getOwner().equals(controller.getClassNode()))
                 ? controller.getInternalClassName()
@@ -1247,7 +1247,7 @@ public class AsmClassGenerator extends ClassGenerator {
         MethodVisitor mv = controller.getMethodVisitor();
         FieldNode field = expression.getField();
 
-        boolean holder = field.isHolder() && !controller.isInClosureConstructor();
+        boolean holder = field.isHolder() && !controller.isInGeneratedFunctionConstructor();
         controller.getOperandStack().doGroovyCast(field);
 
         String ownerName = (field.getOwner().equals(controller.getClassNode()))
@@ -1275,7 +1275,7 @@ public class AsmClassGenerator extends ClassGenerator {
 
         if (expression.isThisExpression()) {
             if (controller.isStaticMethod() || (!controller.getCompileStack().isImplicitThis()
&& controller.isStaticContext())) {
-                if (controller.isInClosure()) classNode = controller.getOutermostClass();
+                if (controller.isInGeneratedFunction()) classNode = controller.getOutermostClass();
                 visitClassExpression(new ClassExpression(classNode));
             } else {
                 loadThis(expression);
@@ -1307,7 +1307,7 @@ public class AsmClassGenerator extends ClassGenerator {
     private void loadThis(final VariableExpression thisExpression) {
         MethodVisitor mv = controller.getMethodVisitor();
         mv.visitVarInsn(ALOAD, 0);
-        if (controller.isInClosure() && !controller.getCompileStack().isImplicitThis())
{
+        if (controller.isInGeneratedFunction() && !controller.getCompileStack().isImplicitThis())
{
             mv.visitMethodInsn(INVOKEVIRTUAL, "groovy/lang/Closure", "getThisObject", "()Ljava/lang/Object;",
false);
             ClassNode expectedType = thisExpression!=null?controller.getTypeChooser().resolveType(thisExpression,
controller.getOutermostClass()):null;
             if (!ClassHelper.OBJECT_TYPE.equals(expectedType) && !ClassHelper.isPrimitiveType(expectedType))
{
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java b/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
index 7156dd9..01a303f 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
@@ -405,7 +405,7 @@ public class ClosureWriter {
     protected void loadThis() {
         MethodVisitor mv = controller.getMethodVisitor();
         mv.visitVarInsn(ALOAD, 0);
-        if (controller.isInClosure()) {
+        if (controller.isInGeneratedFunction()) {
             mv.visitMethodInsn(INVOKEVIRTUAL, "groovy/lang/Closure", "getThisObject", "()Ljava/lang/Object;",
false);
             controller.getOperandStack().push(ClassHelper.OBJECT_TYPE);
         } else {
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/DelegatingController.java b/src/main/java/org/codehaus/groovy/classgen/asm/DelegatingController.java
index de5cedf..7a6198c 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/DelegatingController.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/DelegatingController.java
@@ -205,13 +205,13 @@ public class DelegatingController extends WriterController {
     }
 
     @Override
-    public boolean isInClosure() {
-        return delegationController.isInClosure();
+    public boolean isInGeneratedFunction() {
+        return delegationController.isInGeneratedFunction();
     }
 
     @Override
-    public boolean isInClosureConstructor() {
-        return delegationController.isInClosureConstructor();
+    public boolean isInGeneratedFunctionConstructor() {
+        return delegationController.isInGeneratedFunctionConstructor();
     }
 
     @Override
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java b/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
index 6848dab..1ea8f15 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
@@ -145,7 +145,7 @@ public class InvocationWriter {
                         && !classNode.implementsInterface(declaringClass)) {
                     // we are calling an outer class method
                     compileStack.pushImplicitThis(false);
-                    if (controller.isInClosure()) {
+                    if (controller.isInGeneratedFunction()) {
                         new VariableExpression("thisObject").visit(controller.getAcg());
                     } else {
                         Expression expr = new PropertyExpression(new ClassExpression(declaringClass),
"this");
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
index 6eae8ab..4c124a9 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
@@ -277,17 +277,17 @@ public class WriterController {
         if (compileStack != null && compileStack.getScope() != null) {
             return compileStack.getScope().isInStaticContext();
         }
-        if (!isInClosure()) return false;
+        if (!isInGeneratedFunction()) return false;
         if (isConstructor()) return false;
         return classNode.isStaticClass() || isStaticMethod();
     }
 
-    public boolean isInClosure() {
+    public boolean isInGeneratedFunction() {
         return classNode.getOuterClass() != null && isGeneratedFunction(classNode);
     }
 
-    public boolean isInClosureConstructor() {
-        return isConstructor() && isInClosure();
+    public boolean isInGeneratedFunctionConstructor() {
+        return isConstructor() && isInGeneratedFunction();
     }
 
     public boolean isStaticMethod() {
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
index e6abdaa..5d56aa6 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
@@ -244,7 +244,7 @@ public class StaticInvocationWriter extends InvocationWriter {
         if (bridge != null) {
             Expression fixedReceiver = receiver;
             if (implicitThis) {
-                if (!controller.isInClosure()) {
+                if (!controller.isInGeneratedFunction()) {
                     fixedReceiver = new PropertyExpression(new ClassExpression(lookupClassNode),
"this");
                 } else if (thisClass != null) {
                     ClassNode current = thisClass.getOuterClass();
@@ -292,7 +292,7 @@ public class StaticInvocationWriter extends InvocationWriter {
                     isThisOrSuper = ((VariableExpression) receiver).isThisExpression() ||
((VariableExpression) receiver).isSuperExpression();
                 }
                 Expression fixedReceiver = null;
-                if (isThisOrSuper && classNode instanceof InnerClassNode &&
controller.isInClosure()) {
+                if (isThisOrSuper && classNode instanceof InnerClassNode &&
controller.isInGeneratedFunction()) {
                     ClassNode current = classNode.getOuterClass();
                     fixedReceiver = new VariableExpression("thisObject", current);
                     // adjust for multiple levels of nesting if needed
@@ -332,7 +332,7 @@ public class StaticInvocationWriter extends InvocationWriter {
             }
             ClassNode classNode = controller.getClassNode();
             if (classNode.isDerivedFrom(ClassHelper.CLOSURE_TYPE)
-                    && controller.isInClosure()
+                    && controller.isInGeneratedFunction()
                     && !target.isPublic()
                     && target.getDeclaringClass() != classNode) {
                 if (!tryBridgeMethod(target, receiver, implicitThis, args, classNode)) {
@@ -379,7 +379,7 @@ public class StaticInvocationWriter extends InvocationWriter {
                 if (implicitThis
                         && !classNode.isDerivedFrom(target.getDeclaringClass())
                         && !classNode.implementsInterface(target.getDeclaringClass())
-                        && classNode instanceof InnerClassNode && controller.isInClosure())
{
+                        && classNode instanceof InnerClassNode && controller.isInGeneratedFunction())
{
                     ClassNode current = classNode.getOuterClass();
                     fixedReceiver = new VariableExpression("thisObject", current);
                     // adjust for multiple levels of nesting if needed
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java
index e5e27bc..d8c6166 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java
@@ -311,7 +311,7 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres
                 call.visit(controller.getAcg());
                 return true;
             }
-            if (isThisExpression && !controller.isInClosure()) {
+            if (isThisExpression && !controller.isInGeneratedFunction()) {
                 receiverType = controller.getClassNode();
             }
             if (makeSetPrivateFieldWithBridgeMethod(receiver, receiverType, property, arguments,
safe, spreadSafe, implicitThis)) return true;
@@ -326,7 +326,7 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres
         ClassNode outerClass = receiverType.getOuterClass();
         if (field == null && implicitThis && outerClass != null &&
!receiverType.isStaticClass()) {
             Expression pexp;
-            if (controller.isInClosure()) {
+            if (controller.isInGeneratedFunction()) {
                 MethodCallExpression mce = new MethodCallExpression(
                     new VariableExpression("this"),
                     "getThisObject",
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
index 3c09a11..973408b 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
@@ -388,7 +388,7 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter implements
Opcodes
         ClassNode outerClass = receiverType.getOuterClass();
         if (field == null && implicitThis && outerClass != null &&
!receiverType.isStaticClass()) {
             Expression pexp;
-            if (controller.isInClosure()) {
+            if (controller.isInGeneratedFunction()) {
                 MethodCallExpression mce = new MethodCallExpression(
                         new VariableExpression("this"),
                         "getThisObject",
@@ -434,7 +434,7 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter implements
Opcodes
         TypeChooser typeChooser = controller.getTypeChooser();
         ClassNode classNode = controller.getClassNode();
         ClassNode receiverType = typeChooser.resolveType(receiver, classNode);
-        if (receiver instanceof VariableExpression && ((VariableExpression) receiver).isThisExpression()
&& !controller.isInClosure()) {
+        if (receiver instanceof VariableExpression && ((VariableExpression) receiver).isThisExpression()
&& !controller.isInGeneratedFunction()) {
             receiverType = classNode;
         }
 


Mime
View raw message