RBPatternBlockNode >> #createBlockFor: creates the closure in the way source evaluate and that makes the closure bind self with nil. And that breaks certain usage that expects self to be an instance of RBPatternBlockNode.
This is an example that simply breaks:
| 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
RBPatternBlockNode >> #createBlockFor:creates the closure in the waysource evaluateand that makes the closure bindselfwithnil. And that breaks certain usage that expectsselfto be an instance ofRBPatternBlockNode.This is an example that simply breaks: