Hi Steven,
Le 31/03/2018 à 20:36, Steven Costiou a écrit :
> Hi,
>
> i was browsing the classes of the AST and i am curious about the
> RBPattern* classes.
> What are they used for?
They represent metavariables in pattern trees when you use refactorings.
Each pattern node specify a type of AST subtree that may be in that
place when you match some smalltalk source code against a refactoring
pattern. Once matched, an unification is done so that you can refer to
that metavariable content by name (for example, retrieve the top node of
that variable subtree).
> The RBPatternParser's comment says that it is used "to search and
> transform source code".
Exactly.
> After looking a bit in the senders and class refs, it seems it is used
> for refactorings and other stuff.
Refactorings and searches.
> But is that used at some point in code compilation?
No. But they could be used... if you do source to source transformations
when compiling, for example, you could use such patterns to rewrite the
code before compiling it; SmaCC for one uses that (create generic
methods, then scan all methods with a set of refactorings to rewrite an
optimised version of the code, such as merging contiguous character
equality tests).
For reference, have a look at:
https://www.slideshare.net/pharoproject/smack-behind-the-refactoringsSlide 31 describes the RB specifics, and the rest of the slides describe
more in detail where those pattern nodes are found and used.
Regards,
Thierry
> Steven.
>