There is a certain risk, that the mustBeBooleanMagicIn method rewrite can crash theIssue 13805
vm
"rewrite instvar accessing"We can include more rewrite rules in mustBeBooleanMagicIn likeThe receiver of the rewritten method is the "nonboolean" value receiving theifTrue:ifFalse: message. But the rewritten method can include
instvar accessor and self sends of the original method.
context receiver class instVarNamesAndOffsetsDo: [ :n :o |
RBParseTreeRewriter new
replace: n with: ('ThisContext receiver instVarAt: ', o asString);
executeTree: methodNode.
]."rewrite self sends"RBParseTreeRewriter new
replace: 'self' with: 'ThisContext receiver';
executeTree: methodNode.But I don't know if this works for all possible situations. Or if there are
better ways to do the rewriting.