Re: help with an AST

2017-02-18 Thread Ed Clark

Hi Paul,

Unfortunately that didn't help.  I still get the error:

BUG! exception in phase 'class generation' in source unit 'CtxTest2.groovy' Operation: 
(:  "=" ) not supported


I put those two lines right after my top level "visit" call. Thinking
about it, the class node being visited is that of the top level
script - the classes that are being transformed are not explicitly
being visited.  Perhaps the "visit" at the top level script will descend
into the inner classes?

On the off chance that it won't, I also tried something I found online:

VariableScopeVisitor scopeVisitor = new VariableScopeVisitor( sourceUnit)
sourceUnit.AST.classes.each {
 println '1 visiting class ' + it
 scopeVisitor.visitClass( it)
}

(Obviously, the println is there to check that the xformed classes are visited
explicitly; which they are.)

The error is still there.

I also saw warnings online that you don't want to visit the same scope twice.
If a visit to the top level script implicitly visits the classes defined within,
then this would be a double visit to the xformed classes - I'm guessing.

(Perhaps I need to look at the VariableScopeVisitor implementation to better
understand what's going on.)

Other thoughts/suggestions?

Regards,

Ed


On 02/16/2017 04:41 PM, Paul King wrote:

Do you have something like:

VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source)
scopeVisitor.visitClass(cNode)

for each of your closure(s)? Where cNode is a closure's classNode?

Cheers, Paul.


On Thu, Feb 16, 2017 at 9:35 PM, Ed Clark  wrote:

Ok, a little more headbanging and I seem to have gotten farther (maybe?).
At least the error message has changed.  Now I'm getting:

BUG! exception in phase 'class generation' in source unit 'CtxTest2.groovy'
Operation: (:  "=" ) not supported

Searching hasn't helped with this one.

The xform-ed code looks good -- in fact, if I type the code into a separate
groovyConsole, it will run.  (The console AST generation works up thru
the Instruction Selection phase, obviously.)

I'm guessing it's still with how I'm setting up the scoping (or how I'm not
setting up the scoping).

Ideas, please?

Thanks,

Ed


On 02/14/2017 12:58 PM, Ed Clark wrote:

On 02/14/2017 12:16 PM, Jochen Theodorou wrote:



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 ;)

Maybe I'm too late, and that's why things aren't coming together ;)


[...]

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


Hmmm, I'm close to that, but not quite the same.  I was trying

ExpressionStatement currCtx = new ExpressionStatement(
new DeclarationExpression (
new VariableExpression( "__currCtx$levelcnt"),
new Token( Types.ASSIGNMENT_OPERATOR, "=", -1, -1),
new MethodCallExpression( new VariableExpression( 'this'),
'getDelegate', new ArgumentListExpression())
)
)

Would a DeclarationStatment act differently from an ExpressionStatement
with an embedded
DeclarationExpression?  If my foggy memory is correct, I wrote my code
after looking at the
AST displayed for a short test script in groovyConsole.

Plus, if foggy memory serves, I tried using getOwner and it came back with
the closure being
owned by the test script, not the object doing the with.  Calling
getDelegate gave me the object.
If foggy memory serves.

I also tried playing around with setClosureSharedVariable( true) and
putReferencedLocalVariable()
without success.  But, those were somewhat blind stabs in the dark, so I
might not have been
using them correctly.

Looking at the AST generated by groovyConsole, my transform looks like it
is working, but
the compiler complains about things not being in scope (in the inner
closure).  So, I'm doing
something wrong with setting up the scoping.


  bye Jochen


Thanks,

Ed





Re: New Gant release

2017-02-18 Thread jim northrop
using a new browser named Vivaldi that auto-corrects my spelling !
Incorrectly ! Must turn this feature OFF ;-]

On 18 February 2017 at 12:52, Jim Northrop  wrote:

> Working to learn how to release projects to maven and bin tray using
> cradle but no success yet. If we can get one example working then i can
> help you to release gears v2.0 and (maybe) Gant.
>
> Also Gant is very markdown-ish, so is it worth changing it to asciidoctor
> versions of same ? - Just thinking’ ;-}
>
> thx
> Jim
>
> On 12 Feb 2017, at 22:17, Keegan Witt  wrote:
>
> Hi Russel,
> I use Sonatype to publish GMavenPlus.  They have instructions here
> http://central.sonatype.org/pages/ossrh-guide.html. It automatically
> syncs with Maven Central. Would that be simpler?
>
> -Keegan
>
> On Feb 12, 2017 9:26 AM, "Russel Winder"  wrote:
>
>> There were a couple of bugfixes in Gant that needed releasing. Also it
>> has been 20 months since the last release. Given the build changes, the
>> Groovy version changes, and ditching Java 6 support, I went for a minor
>> release rather than a bugfix release. So we now have 1.10.0.
>>
>> Now the problem: The last release was in the Codehaus era, which has
>> now sadly (but also splendidly given the now Apache connection for
>> Groovy) demised. This means I need to find the JCenter route to Maven
>> Central. Schalk Cronjé did some work a while back trying to get the
>> Bintray and Artifactory plugins working, so there is groundwork but no
>> working system.
>>
>> I tweeted to see if Schalk and possibly Baruch Sadogursky could give me
>> a hand. If anyone else has JCenter and Maven Central skills for
>> deploying a release, please do wander over to   https://github.com/Gant
>> /Gant  and take a peek.
>>
>> --
>> Russel.
>> 
>> =
>> Dr Russel Winder  t: +44 20 7585 2200   voip:
>> sip:russel.win...@ekiga.net
>> 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
>> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
>
>
>