summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-21 13:33:47 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-21 13:33:47 -0700
commitfff96ff7ba60666c4326671f42f6425b50f620f1 (patch)
tree142d4379fb0ea10b1600ccfe1c10b42f142af2e1 /op.c
parent307f421781d6c83f78141d5a4fd6d07b4cd3660c (diff)
downloadperl-fff96ff7ba60666c4326671f42f6425b50f620f1.tar.gz
Stop ‘sub :lvalue :Foo’ from applying :lvalue to defined subs
This is something that commit 885ef6f missed. See ticket #68758 and the perldelta diff in this commit. I thought that the prototype-application inconsistencies mention in <2C7C1BF5-A814-4F5E-B10E-E431B71BA8CA@cpan.org> would get in the way of this, but I found that the easiest way to fix it actually did not change any of that. So those issues can wait till another day.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index 8792a2fac3..e5780e323e 100644
--- a/op.c
+++ b/op.c
@@ -6214,7 +6214,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
#ifdef PERL_MAD
|| block->op_type == OP_NULL
#endif
- )&& !attrs) {
+ )) {
if (CvFLAGS(PL_compcv)) {
/* might have had built-in attrs applied */
const bool pureperl = !CvISXSUB(cv) && CvROOT(cv);
@@ -6225,6 +6225,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
(CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS
& ~(CVf_LVALUE * pureperl));
}
+ if (attrs) goto attrs;
/* just a "sub foo;" when &foo is already defined */
SAVEFREESV(PL_compcv);
goto done;
@@ -6350,6 +6351,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
CvFILE_set_from_cop(cv, PL_curcop);
CvSTASH_set(cv, PL_curstash);
}
+ attrs:
if (attrs) {
/* Need to do a C<use attributes $stash_of_cv,\&cv,@attrs>. */
HV *stash = name && GvSTASH(CvGV(cv)) ? GvSTASH(CvGV(cv)) : PL_curstash;