Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of $_ in blocks to if/unless mods
The program: for 1..3 { { say $_; last } if $_ == 2 } Recently started to output `True` instead of `2`. This bissected to the recent optimizer change to the immediate block inlining. However, even disabling the optimizer still showed up the bug. In fact, a bissect with the optimizer disabled revealed that the optimizer had a bug, fixed in commit 541a4f1, that caused it to do immediate inlining of blocks that it shouldn't have before. This optimizer bug hid another bug; a bissect with the optimizer disabled led to a fix from around a year ago, which in turn caused `{ say $_ } if $_ == 2` to be compiled as if it were `if $_ == 2 -> $_ { say $_ }`. This change makes sure that we compile the construct correctly, thus fixing the issue that the optimizer bug had hidden.
- Loading branch information