groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [3/4] groovy git commit: Trivial refactoring
Date Mon, 04 Dec 2017 03:30:32 GMT
Trivial refactoring

(cherry picked from commit d9c74df)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 54b8ac98c784999dd022c837de67b97be77c3b1d
Parents: 0c074f7
Author: sunlan <sunlan@apache.org>
Authored: Mon Dec 4 08:54:47 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Dec 4 11:30:21 2017 +0800

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/54b8ac98/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 4b174ec..42af62d 100644
--- a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -1294,7 +1294,7 @@ public class AsmClassGenerator extends ClassGenerator {
         }
 
         addInnerClass(icl);
-        for (Map.Entry<String,ClassNode> entry : referencedClasses.entrySet()) {  
         // generate a field node
+        for (Map.Entry<String, ClassNode> entry : referencedClasses.entrySet()) { 
          // generate a field node
             String staticFieldName = entry.getKey();
             ClassNode cn = entry.getValue();
             icl.addField(staticFieldName, ACC_STATIC + ACC_SYNTHETIC, ClassHelper.CLASS_Type.getPlainNodeReference(),
new ClassExpression(cn));
@@ -1306,7 +1306,9 @@ public class AsmClassGenerator extends ClassGenerator {
             return;
         }
         MethodVisitor mv;
-        for (String staticFieldName : referencedClasses.keySet()) {
+        for (Map.Entry<String, ClassNode> entry : referencedClasses.entrySet()) {
+            String staticFieldName = entry.getKey();
+            ClassNode cn = entry.getValue();
             // generate a field node
             FieldNode fn = controller.getClassNode().getDeclaredField(staticFieldName);
             if (fn != null) {
@@ -1333,7 +1335,7 @@ public class AsmClassGenerator extends ClassGenerator {
             Label l0 = new Label();
             mv.visitJumpInsn(IFNONNULL,l0);
             mv.visitInsn(POP);
-            mv.visitLdcInsn(BytecodeHelper.getClassLoadingTypeDescription(referencedClasses.get(staticFieldName)));
+            mv.visitLdcInsn(BytecodeHelper.getClassLoadingTypeDescription(cn));
             mv.visitMethodInsn(INVOKESTATIC, controller.getInternalClassName(), "class$",
"(Ljava/lang/String;)Ljava/lang/Class;", false);
             mv.visitInsn(DUP);
             mv.visitFieldInsn(PUTSTATIC,controller.getInternalClassName(),staticFieldName,"Ljava/lang/Class;");


Mime
View raw message