summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-10-18 10:23:26 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-10-18 12:49:27 -0700
commit01762542fcff2d3eb5e0fd287f28e872a0cfd5a4 (patch)
tree5ff1efca76f6b548b3561301aa34673a55b428e2 /lib
parent28482d6cad995d14acdad04e18ee2d4ee32c6a18 (diff)
downloadperl-01762542fcff2d3eb5e0fd287f28e872a0cfd5a4.tar.gz
Use srefgen for anoncode
srefgen is faster than refgen, since it doesn’t have to loop through the arguments (there is only one) and there is no pushmark to execute. OA_RETSCALAR causes scalar context to be applied to anoncode ops, but it always returns one item anyway, so that causes no problems.
Diffstat (limited to 'lib')
-rw-r--r--lib/B/Deparse.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm
index ddf2952d9b..3866f328b4 100644
--- a/lib/B/Deparse.pm
+++ b/lib/B/Deparse.pm
@@ -2303,10 +2303,11 @@ sub pp_refgen {
my($op, $cx) = @_;
my $kid = $op->first;
if ($kid->name eq "null") {
- $kid = $kid->first;
- if (!null($kid->sibling) and
- $kid->sibling->name eq "anoncode") {
- return $self->e_anoncode({ code => $self->padval($kid->sibling->targ) });
+ my $anoncode = $kid = $kid->first;
+ if ($anoncode->name eq "anoncode"
+ or !null($anoncode = $kid->sibling) and
+ $anoncode->name eq "anoncode") {
+ return $self->e_anoncode({ code => $self->padval($anoncode->targ) });
} elsif ($kid->name eq "pushmark") {
my $sib_name = $kid->sibling->name;
if ($sib_name eq 'entersub') {