On 11 avr. 2013, at 15:37, Marcus Denker wrote:
30033 -----
10177 Deprecate accept* in visitor https://pharo.fogbugz.com/f/cases/10177
Deprecate the wrong protocol for AST visitors. Visitors do not accept they visit.
- Clean also the messages send but not implemented - rationalize the API now methods are named * Node
The code to automatically rewrite all visitors is this (we tested with Opal):
m := (RBProgramNodeVisitor allSubclasses gather: #methods) select: [ :e | e selector beginsWith: 'accept' ]. m do: [ :e | e methodClass compile: (e sourceCode copyReplaceAll: 'accept' with: 'visit'). e methodClass removeSelector: e selector ].
Even if this script should do most of the work, one still needs to check the senders of the old selectors before.
(self systemNavigation allSendersOf: #acceptInlinedBlockNode:) do: [ :e | e methodClass compile: (e sourceCode copyReplaceAll: 'acceptInlinedBlockNode:' with: 'visitInlinedBlockNode:')
This last part is specific to Opal for example to rewrite the senders of #acceptInlinedBlock:.