groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: help with an AST
Date Tue, 14 Feb 2017 17:16:16 GMT


On 14.02.2017 12:41, Ed Clark wrote:
> Hi Jochen,
>
> Well, I've been slowly making progress on this; kind of feels like
> bashing my
> head against a wall at times, but I have made a small hole in the wall
> through
> which I can see my goal. ;-)

making holes my lead to brain damage.. then things get really hard to 
solve ;)

[...]
> Specifically, I haven't figured out how to inject a variable into the
> scope of an outer
> with's closure that can be used by code in an interior with's closure.
> For example,
> consider
>
>   myCtx1.with {
>       __outerCtx1 = null            // injected statement
>       __currCtx1 = myCtx1       // injected statement
>       .... some code ...
>       myCtx2.with {
>           __outerCtx2 = __currCtx1   // injected statement <---  doesn't
> work
>           __currCtx2 = myCtx2          // injected statement

where is __currCtx1 and __outerCtx1 coming from? Are they supposed to be 
new local variables? in that case you will have to add a 
DeclarationStatement, not just an assignment to a VariableExpression. 
Otherwise the compiler will thnk they are dynamic properties and tries 
to resolve them against the context.

as for the logic behind __outerCtxN... with number wouldn't have to be 
null I would have said you should think of using getOwner on Closure

  bye Jochen

Mime
View raw message