Fix deparsing of "" =~ <any OPf_SPECIAL op>
authorFather Chrysostomos <sprout@cpan.org>
Thu, 8 Dec 2011 06:13:50 +0000 (22:13 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 8 Dec 2011 14:18:09 +0000 (06:18 -0800)
commit5e5a163216c3593e94fd0a7d0b251dc6a82d8991
tree882b251c82c30c9c12eeca52c30673e1957b7ffa
parent41df74e3c36f10fc6ff6e27a5505709a5d21c1cc
Fix deparsing of "" =~ <any OPf_SPECIAL op>

This is a regression in 5.14.

$ ./perl -Ilib -MO=Deparse -e '"" =~ do{}'
'' =~ ($_ =~ do {
    ()
});
-e syntax OK

Commit a539498ab05 fixed the deparsing of "foo" =~ (1?/foo/:/bar/),
in which /foo/ is implicitly bound to $_.  Due to constant folding,
the whole condition expression is reduced to "foo" =~ /foo/, but with
/foo/ still bound to $_.  /foo/ is marked OPf_SPECIAL, which allows
us to distinguish the cases.  The fix, which added "$_ =~" explic-
itly, did not check that the op was a match op, so any op on the rhs
with the OPf_SPECIAL flag set could trigger the same special case.
dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/deparse.t