This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_check_for_bool_cxt(): avoid OPpTARGET_MY + bool
authorDavid Mitchell <davem@iabyn.com>
Fri, 14 Jul 2017 10:50:16 +0000 (11:50 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 27 Jul 2017 10:30:23 +0000 (11:30 +0100)
commita247dbb235b6ada82425a663c4ebd4f426e4947f
treed7f620479d45f39151935e54a2419eaa7b03afb0
parent5febd2ff83ad8541c2fd1f43266e321d057ef865
S_check_for_bool_cxt(): avoid OPpTARGET_MY + bool

Where an op allows the OA_TARGLEX optimisation (which eliminates the
assign op in '$lex = foo' and just sets the targ directly - which may be a
padtmp or $lex - the op doesn't care), disallow setting a boolean context
flag on that op. Because if the op does something like

    if (OPpTRUEBOOL)
        SETs(cond ? &PL_sv_yes : &PL_sv_no)

skipping assigning to TARG, then $lex won't get set.
op.c