diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-23 06:31:06 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-23 06:31:06 -0700 |
commit | a3534fd4c448e568d5b7ab5ce6ad8c6181770a4a (patch) | |
tree | c462a24630df945013b92e271732a5ac08ace70e | |
parent | 15d5366615cf7cfe9bedca98f006575eed87fb8a (diff) | |
download | perl-a3534fd4c448e568d5b7ab5ce6ad8c6181770a4a.tar.gz |
Revert "Make lvalue subs copy returned PADTMPs in rvalue cx"
This reverts commit ab2dde4dec2fdb7a4916f146412cf3b2d173df5a.
-rw-r--r-- | pp_ctl.c | 19 | ||||
-rw-r--r-- | t/op/coresubs.t | 5 | ||||
-rw-r--r-- | t/op/sub_lval.t | 20 |
3 files changed, 5 insertions, 39 deletions
@@ -2370,24 +2370,13 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme, if (MARK < SP) { copy_sv: if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) { - if (!SvPADTMP(*SP)) { *++newsp = SvREFCNT_inc(*SP); FREETMPS; sv_2mortal(*newsp); - } - else { - /* FREETMPS could clobber it */ - SV *sv = SvREFCNT_inc(*SP); - FREETMPS; - *++newsp = sv_mortalcopy(sv); - SvREFCNT_dec(sv); - } } else *++newsp = - SvPADTMP(*SP) - ? sv_mortalcopy(*SP) - : !SvTEMP(*SP) + !SvTEMP(*SP) ? sv_2mortal(SvREFCNT_inc_simple_NN(*SP)) : *SP; } @@ -2407,10 +2396,10 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme, if (ref || !CxLVAL(cx)) while (++MARK <= SP) *++newsp = - SvFLAGS(*MARK) & SVs_PADTMP + SvTEMP(*MARK) + ? *MARK + : ref && SvFLAGS(*MARK) & SVs_PADTMP ? sv_mortalcopy(*MARK) - : SvTEMP(*MARK) - ? *MARK : sv_2mortal(SvREFCNT_inc_simple_NN(*MARK)); else while (++MARK <= SP) { if (*MARK != &PL_sv_undef diff --git a/t/op/coresubs.t b/t/op/coresubs.t index 85084bb531..b0263ee8de 100644 --- a/t/op/coresubs.t +++ b/t/op/coresubs.t @@ -125,11 +125,6 @@ $tests++; ok eval { *CORE::exit = \42 }, '[rt.cpan.org #74289] *CORE::foo is not accidentally made read-only'; -@UNIVERSAL::ISA = CORE; -is "just another "->ucfirst . "perl hacker,\n"->ucfirst, - "Just another Perl hacker,\n", 'coresubs do not return TARG'; -++$tests; - done_testing $tests; CORE::__END__ diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index b2f56e3374..7008caf40a 100644 --- a/t/op/sub_lval.t +++ b/t/op/sub_lval.t @@ -3,7 +3,7 @@ BEGIN { @INC = '../lib'; require './test.pl'; } -plan tests=>191; +plan tests=>187; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -944,21 +944,3 @@ package _102486 { ::like $@, qr/^Can't modify non-lvalue subroutine call at /, 'sub:lvalue{&$x}->() dies in true lvalue context'; } - -# TARG should be copied in rvalue context -sub ucf :lvalue { ucfirst $_[0] } -is ucf("just another ") . ucf("perl hacker,\n"), - "Just another Perl hacker,\n", 'TARG is copied in rvalue scalar cx'; -is join('',ucf("just another "), ucf "perl hacker,\n"), - "Just another Perl hacker,\n", 'TARG is copied in rvalue list cx'; -sub ucfr : lvalue { - @_ ? ucfirst $_[0] : do { - is ucfr("just another ") . ucfr("perl hacker,\n"), - "Just another Perl hacker,\n", - 'TARG is copied in recursive rvalue scalar cx'; - is join('',ucfr("just another "), ucfr("perl hacker,\n")), - "Just another Perl hacker,\n", - 'TARG is copied in recursive rvalue list cx'; - } -} -ucfr(); |