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: Trivial refactoring: reuse `size` variable of `castToBool`
Date Thu, 08 Feb 2018 01:23:20 GMT
Trivial refactoring: reuse `size` variable of `castToBool`

(cherry picked from commit c376685)

(cherry picked from commit 700cf3f)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: b8c7366c14100be8c4efa66b5645019f81ccc921
Parents: 9f890da
Author: sunlan <sunlan@apache.org>
Authored: Thu Feb 8 07:56:56 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Feb 8 09:22:41 2018 +0800

----------------------------------------------------------------------
 .../groovy/classgen/asm/OperandStack.java         | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b8c7366c/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java b/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java
index 105a8b4..5dc3743 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java
@@ -135,7 +135,7 @@ public class OperandStack {
     public void castToBool(int mark, boolean emptyDefault) {
         int size = stack.size();
         MethodVisitor mv = controller.getMethodVisitor();
-        if (mark==size) {
+        if (mark == size) {
             // no element, so use emptyDefault
             if (emptyDefault) {
                 mv.visitIntInsn(BIPUSH, 1);
@@ -143,8 +143,8 @@ public class OperandStack {
                 mv.visitIntInsn(BIPUSH, 0);
             }
             stack.add(null);
-        } else if (mark==stack.size()-1) {
-            ClassNode last =  stack.get(size-1);
+        } else if (mark == size - 1) {
+            ClassNode last = stack.get(size - 1);
             // nothing to do in that case
             if (last == ClassHelper.boolean_TYPE) return;
             // not a primitive type, so call booleanUnbox
@@ -152,14 +152,14 @@ public class OperandStack {
                 controller.getInvocationWriter().castNonPrimitiveToBool(last);
             } else {
                 BytecodeHelper.convertPrimitiveToBoolean(mv, last);
-            }            
-        } else { 
+            }
+        } else {
             throw new GroovyBugError(
-                    "operand stack contains "+stack.size()+
-                    " elements, but we expected only "+mark
-                );
+                    "operand stack contains " + size +
+                            " elements, but we expected only " + mark
+            );
         }
-        stack.set(mark,ClassHelper.boolean_TYPE);
+        stack.set(mark, ClassHelper.boolean_TYPE);
     }
 
     /**


Mime
View raw message