Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X e01fbec64 -> 7d1654a92


Trivial refactoring: remove pointless `if`

(cherry picked from commit 5d5b590)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: e07c0dcb399fc3cf7b0cb47d0b21281030c86495
Parents: e01fbec
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Mon Feb 19 23:17:25 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Mon Feb 19 23:53:36 2018 +0800

----------------------------------------------------------------------
 .../groovy/classgen/asm/ClosureWriter.java      | 42 ++++++++++----------
 1 file changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e07c0dcb/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
----------------------------------------------------------------------
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 7c44599..22b8653 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java
@@ -278,28 +278,26 @@ public class ClosureWriter {
         for (Parameter param : localVariableParams) {
             String paramName = param.getName();
             ClassNode type = param.getType();
-            if (true) {
-                VariableExpression initialValue = new 
VariableExpression(paramName);
-                initialValue.setAccessedVariable(param);
-                initialValue.setUseReferenceDirectly(true);
-                ClassNode realType = type;
-                type = ClassHelper.makeReference();
-                param.setType(ClassHelper.makeReference());
-                FieldNode paramField = answer.addField(paramName, ACC_PRIVATE 
| ACC_SYNTHETIC, type, initialValue);
-                
paramField.setOriginType(ClassHelper.getWrapper(param.getOriginType()));
-                paramField.setHolder(true);
-                String methodName = Verifier.capitalize(paramName);
-
-                // let's add a getter & setter
-                Expression fieldExp = new FieldExpression(paramField);
-                answer.addMethod(
-                        "get" + methodName,
-                        ACC_PUBLIC,
-                        realType.getPlainNodeReference(),
-                        Parameter.EMPTY_ARRAY,
-                        ClassNode.EMPTY_ARRAY,
-                        new ReturnStatement(fieldExp));
-            }
+            VariableExpression initialValue = new 
VariableExpression(paramName);
+            initialValue.setAccessedVariable(param);
+            initialValue.setUseReferenceDirectly(true);
+            ClassNode realType = type;
+            type = ClassHelper.makeReference();
+            param.setType(ClassHelper.makeReference());
+            FieldNode paramField = answer.addField(paramName, ACC_PRIVATE | 
ACC_SYNTHETIC, type, initialValue);
+            
paramField.setOriginType(ClassHelper.getWrapper(param.getOriginType()));
+            paramField.setHolder(true);
+            String methodName = Verifier.capitalize(paramName);
+
+            // let's add a getter & setter
+            Expression fieldExp = new FieldExpression(paramField);
+            answer.addMethod(
+                    "get" + methodName,
+                    ACC_PUBLIC,
+                    realType.getPlainNodeReference(),
+                    Parameter.EMPTY_ARRAY,
+                    ClassNode.EMPTY_ARRAY,
+                    new ReturnStatement(fieldExp));
         }
     }
 

Reply via email to