Le 09/11/2015 17:38, Mariano Martinez Peck a écrit :
Thierry, I have a last question. My last requirement will basically be
to find ANY node that would match the regex *oldSelector* and rename it
to *newSelector* being that.. a literal string, a literal symbol, a
message send, a tempVar name, a comment, etc... I guess there is a
simpler way that defining rewrite for each type of node right?
I can always do a "(methodSource substrings detect: [:each | each
matches: '*oldSelector'] ifNone: [#()] )   each2: [:each2 | copReplace.
.... ]

I think that if it is really everywhere, then it may works better to just do text replace (methodSource copyReplaceAll: 'oldSelector' with: 'newSelector').

But remember that it will touch everything (pragmas, varNames, comments, etc.)

but RB is probably better.

It gives you more control to what you will change. But then you will have to write rewrites for all types of nodes (around 6 or 7?).

Any clues in this last requirement?

Well, one thing which may be interesting would be to consider encapsulating the rewrites in refactoring commands, and bring them as a composite change, so that you could launch a rewrite, recover all those method changes, apply (execute) them, check the result with the possibility of undoing them.

But I'm not familiar with that part of RB. I do consider it could become significant with EPICEA. It has been a long term project to have AltBrowser make all coding actions as refactoring commands so that EPICEA could log them properly, but its only partly there (and has been for years now)... and EPICEA is not yet here as well (but could be soon).

Thierry

Reply via email to