There is a certain risk, that the mustBeBooleanMagicIn method rewrite can crash the
vm
Issue 13805The receiver of the rewritten method is the "nonboolean" value receiving the
ifTrue:ifFalse: message. But the rewritten method can include
instvar accessor and self sends of the original method.
We can include more rewrite rules in mustBeBooleanMagicIn like
�� "rewrite instvar accessing"
������ 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.