groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [3/3] groovy git commit: GROOVY-8222: Setting Source Position in newly created PropertyExpression (closes #559)
Date Sat, 08 Jul 2017 19:27:28 GMT
GROOVY-8222: Setting Source Position in newly created PropertyExpression (closes #559)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 7f00a29e073ef40d62ac1b8c912fca378ca873e6
Parents: 1e0c2e9
Author: Arsen Babakhanyan <arsen.ba@gmail.com>
Authored: Sun Jun 11 18:06:29 2017 +0400
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Sat Jul 8 12:26:32 2017 -0700

----------------------------------------------------------------------
 .../org/codehaus/groovy/classgen/AsmClassGenerator.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7f00a29e/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 68be508..6f50af8 100644
--- a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -1219,7 +1219,7 @@ public class AsmClassGenerator extends ClassGenerator {
 
         BytecodeVariable variable = controller.getCompileStack().getVariable(variableName,
false);
         if (variable == null) {
-            processClassVariable(variableName);
+            processClassVariable(expression);
         } else {
             controller.getOperandStack().loadOrStoreVariable(variable, expression.isUseReferenceDirectly());
         }
@@ -1243,7 +1243,7 @@ public class AsmClassGenerator extends ClassGenerator {
         }
     }
 
-    private void processClassVariable(String name) {
+    private void processClassVariable(VariableExpression expression) {
         if (passingParams && controller.isInScriptBody()) {
             //TODO: check if this part is actually used
             MethodVisitor mv = controller.getMethodVisitor();
@@ -1252,11 +1252,13 @@ public class AsmClassGenerator extends ClassGenerator {
             mv.visitInsn(DUP);
 
             loadThisOrOwner();
-            mv.visitLdcInsn(name);
+            mv.visitLdcInsn(expression.getName());
 
             mv.visitMethodInsn(INVOKESPECIAL, "org/codehaus/groovy/runtime/ScriptReference",
"<init>", "(Lgroovy/lang/Script;Ljava/lang/String;)V", false);
         } else {
-            PropertyExpression pexp = new PropertyExpression(new VariableExpression("this"),
name);
+            PropertyExpression pexp = new PropertyExpression(new VariableExpression("this"),
expression.getName());
+            pexp.getObjectExpression().setSourcePosition(expression);
+            pexp.getProperty().setSourcePosition(expression);
             pexp.setImplicitThis(true);
             visitPropertyExpression(pexp);
         }


Mime
View raw message