[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question on AST transformations

I'm on holidays and can't really check right now but I wouldn't necessarily assume a compilation error.

On Fri., 1 Jun. 2018, 7:25 pm josedeoliveiraguimaraes@xxxxxxxxx, <josedeoliveiraguimaraes@xxxxxxxxx> wrote:
Thanks a lot, Paul. That will be very helpful in the second article I am preparing on the Metaobject Protocol of language Cyan. The first article is available in By the way, it cites your Groovy book.

One more question: suppose an AST transformation class inserts a method and a field in a class 'HelpMe'. That is made in the SEMANTIC_ANALYSIS phase (maybe another phase, I think it does not matter). Another class 'Other' accesses the inserted field and call the inserted method of 'HelpMe'. Annotation @CompileStatic is attached to 'Other'. Assume that the semantic analysis of 'Other' is made before that of 'HelpMe' (I am assuming there is no pre-defined compilation order between the source files, then it could be 'HelpMe' before 'Other' but the problem that follows should not happen in this case). That will cause a compile error because the field and method will not be found in 'HelpMe'. Is that correct?

Cheers, José