Sorry to bother again. Unfortunately, RB does not work out of the box in GemStone .... only the formatter part. grrr.
| tree rewriter |
tree := RBParser parseMethod: 'DoIt ^ [:proxy | proxy at: #oldSelector. ]'.
rewriter := RBParseTreeRewriter new.
rewriter��
replace: ('`#oldSelector `{:node | node value isSymbol and: [node value matchesRegex: ''.*oldSelector.*''] }')
with: ('`{RBLiteralNode value: (`#oldSelector value copyReplaceAll: ''oldSelector'' with: ''newSelector'') asSymbol }').
rewriter executeTree: tree.
rewriter tree newSource
And the problem is the line:
with: ('`{RBLiteralNode value: (`#oldSelector value copyReplaceAll: ''oldSelector'' with: ''newSelector'') asSymbol }').
which gets translated to:
[ :aDictionary |��
RBLiteralNode
�� value:
�� �� ((self lookupMatchFor: '`#oldSelector' in: aDictionary) value
�� �� �� copyReplaceAll: 'oldSelector'
�� �� �� with: 'newSelector') asSymbol ]
The problem in GemStone is that that "self" is binded to nil and not to the receiver instance (RBPatternBlockNode). And so I get a Nil dnu..
And I don't know how that closure is finally generated.
The message node:
(self lookupMatchFor: '`#oldSelector' in: aDictionary) ��
Its generated in:
RBPatternBlockNode >> constructLookupNodeFor: aString in: aRBBlockNode��
| argumentNode |
argumentNode := RBLiteralNode value: aString.
^RBMessageNode��
receiver:��(RBVariableNode named: 'self')
selector: #lookupMatchFor:in:
arguments: (Array with: argumentNode with: aRBBlockNode arguments last)
��
Any ideas?
thanks in advance,