diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-24 22:28:34 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-25 05:36:56 -0800 |
commit | 60f71a82f635e2a8a70b36c2a82b27b78602408f (patch) | |
tree | 643e76cf4422f927444b71b372c3cd74462282bc /op.c | |
parent | 71faf10a29dcbf55255bd39e6d95e5abbe97958b (diff) | |
download | perl-60f71a82f635e2a8a70b36c2a82b27b78602408f.tar.gz |
Allow \(&sub) for & proto
I accidentally broke this in e41e9865. Prior to this commit,
\&foo was becoming srefgen and \(&foo) was becoming refgen.
Srefgen is a slightly faster version of refgen that only han-
dles one item. The easiest fix was to change the logic
in op.c:ck_spair so that \(&sub) with parens becomes srefgen.
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -9358,10 +9358,11 @@ Perl_ck_spair(pTHX_ OP *o) const OPCODE type = newop->op_type; if (OP_HAS_SIBLING(newop)) return o; - if (o->op_type == OP_REFGEN && !(newop->op_flags & OPf_PARENS) - && (type == OP_RV2AV || type == OP_PADAV - || type == OP_RV2HV || type == OP_PADHV - || type == OP_RV2CV)) + if (o->op_type == OP_REFGEN + && ( type == OP_RV2CV + || ( !(newop->op_flags & OPf_PARENS) + && ( type == OP_RV2AV || type == OP_PADAV + || type == OP_RV2HV || type == OP_PADHV)))) NOOP; /* OK (allow srefgen for \@a and \%h) */ else if (!(PL_opargs[type] & OA_RETSCALAR)) return o; |