diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-06-23 08:16:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-06-23 10:23:45 -0700 |
commit | 0accd0eeebd92a8877c7f7ecc13c7cb3ec364faa (patch) | |
tree | aa12618ebb7071bd8c78474e3ada0b128623706d /pp_ctl.c | |
parent | bf1857d8fffd6739904f9f8dfa5e615f46485383 (diff) | |
download | perl-0accd0eeebd92a8877c7f7ecc13c7cb3ec364faa.tar.gz |
Collapse the list context code in pp_leavesublv
Two branches of this three-branch if/elsif were doing the same thing.
One was written out longhand.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 33 |
1 files changed, 8 insertions, 25 deletions
@@ -2581,27 +2581,16 @@ PP(pp_leavesublv) } } else if (gimme == G_ARRAY) { + const bool ref = CxLVAL(cx) & OPpENTERSUB_INARGS; assert(!(CxLVAL(cx) & OPpENTERSUB_DEREF)); - if (CxLVAL(cx) & OPpENTERSUB_INARGS) { - /* We are an argument to a function or grep(). - * This kind of lvalueness was legal before lvalue - * subroutines too, so be backward compatible: - * cannot report errors. */ - mark = newsp + 1; - EXTEND_MORTAL(SP - newsp); - for (mark = newsp + 1; mark <= SP; mark++) { - if (SvTEMP(*mark)) - NOOP; - else if (SvFLAGS(*mark) & SVs_PADTMP) - *mark = sv_mortalcopy(*mark); - else { - /* Can be a localized value subject to deletion. */ - PL_tmps_stack[++PL_tmps_ix] = *mark; - SvREFCNT_inc_void(*mark); - } + if (ref||!CxLVAL(cx)) + for (MARK = newsp + 1; MARK <= SP; MARK++) { + if (!SvTEMP(*MARK)) + *MARK = ref && SvFLAGS(*mark) & SVs_PADTMP + ? sv_mortalcopy(*mark) + : sv_2mortal(SvREFCNT_inc_simple_NN(*MARK)); } - } - else if (CxLVAL(cx)) { /* Leave it as it is if we can. */ + else { /* Leave it as it is if we can. */ EXTEND_MORTAL(SP - newsp); for (mark = newsp + 1; mark <= SP; mark++) { if (*mark != &PL_sv_undef @@ -2627,12 +2616,6 @@ PP(pp_leavesublv) } } } - else { - for (MARK = newsp + 1; MARK <= SP; MARK++) { - if (!SvTEMP(*MARK)) - *MARK = sv_2mortal(SvREFCNT_inc_simple_NN(*MARK)); - } - } } PUTBACK; |