Hi everyone !
I'm currently playing with AST transformations, and the field of
opportunities is... Well... Huge !
There's just something I just can't figure out how to express properly.
Let's imagine the following class :
class Greeter {
void greet(String firstname, String lastname) {
"Hello $firstname $lastname"
}
}
I'd like to write an AST transformation so that the class becomes :
class Greeter {
void greet(String firstname, String lastname) {
"Hello $firstname $lastname"
}
CurriedClosure greet2(String firstname) { // even better if it's named
"greet" but... ?
this.&greet.curry(firstname)
}
}
And I'm not really sure if it's even possible with AST transformations, and
if I should go with ASTbuilder.buildFromCode or buildFromSpec, or anything
else ...
I'm able to get the methodNode i want to add a method for, no problem, I'm
able to add a method to a class, no problem.
The problem is just creating the definition of the AST method.
If someone has any pointer I can look at to give me an idea, don't hesitate.
Thanks a lot, and keep up the good work !
Arnaud.