groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonard Brünings <groovy-...@bruenings-it.net>
Subject Re: Get reference to enclosing closure
Date Mon, 20 Nov 2017 23:52:05 GMT
Spock doesn't rewrite it to `this.getThisObject()`.

This is what Spock does

|with(list) {|

|   SpockRuntime.verifyMethodCondition(this, "contains", [1])|

|}

|

|The transformation from `this` to `this.getThisObject()` is done by 
groovy at a later stage.
My guess somewhere in the AST-to-Bytecode ASM code as I can see the 
upper version in the
last stage of the AST-Transforms.
|||


|with(list) {|

|   SpockRuntime.verifyMethodCondition(this.getThisObject(), "contains", 
[1])|

|}|||
Am 20.11.2017 um 22:09 schrieb eric.milles@thomsonreuters.com:
>
> When you rewrite to this form:
>
> |with(list) {|
> |  SpockRuntime.verifyMethodCondition(this.getThisObject(), "contains", 
> [1])|
>
> |}|
>
> You've esentially frozen your choice of delegate, owner or this. The 
> dynamic resolution of "implicit this" to one of those is no longer 
> going to happen.  I guess you'd need to re-implement the resolution 
> strategy.
>


Mime
View raw message