You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2019/12/19 00:39:21 UTC

[groovy] branch GROOVY-9341 created (now be8fa03)

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a change to branch GROOVY-9341
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at be8fa03  GROOVY-9341: fix "this" support for nested lambda expressions

This branch includes the following new commits:

     new be8fa03  GROOVY-9341: fix "this" support for nested lambda expressions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: GROOVY-9341: fix "this" support for nested lambda expressions

Posted by em...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY-9341
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit be8fa032ef236f2bced98a8d89b45b110687d5b1
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Dec 18 18:29:03 2019 -0600

    GROOVY-9341: fix "this" support for nested lambda expressions
    
    ClosureWriter#loadThis() writes call to Closure#getThisObject()
---
 .../org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java  | 3 +--
 src/test/groovy/transform/stc/LambdaTest.groovy                       | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
index cfce5c5..67cf98e 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
@@ -177,8 +177,7 @@ public class StaticTypesLambdaWriter extends LambdaWriter implements AbstractFun
         if (controller.isStaticMethod() || compileStack.isInSpecialConstructorCall() || !accessingInstanceMembers) {
             operandStack.pushConstant(ConstantExpression.NULL);
         } else {
-            mv.visitVarInsn(ALOAD, 0);
-            operandStack.push(controller.getClassNode());
+            loadThis();
         }
 
         operandStack.dup();
diff --git a/src/test/groovy/transform/stc/LambdaTest.groovy b/src/test/groovy/transform/stc/LambdaTest.groovy
index 48cf528..ac3f138 100644
--- a/src/test/groovy/transform/stc/LambdaTest.groovy
+++ b/src/test/groovy/transform/stc/LambdaTest.groovy
@@ -1031,7 +1031,7 @@ final class LambdaTest {
         '''
     }
 
-    @Test @NotYetImplemented
+    @Test
     void testNestedLambdaAccessingInstanceFields() {
         assertScript '''
             @groovy.transform.CompileStatic
@@ -1097,7 +1097,7 @@ final class LambdaTest {
         '''
     }
 
-    @Test @NotYetImplemented
+    @Test
     void testAccessingThis2() {
         assertScript '''
             @groovy.transform.CompileStatic