diff options
author | demerphq <demerphq@gmail.com> | 2009-10-15 14:22:47 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-10-15 14:22:47 +0100 |
commit | 1c85afcecc8ee030e2780aa5bfa85692c8db64df (patch) | |
tree | daeb0254e5a730eb7d909b41e4837e6d9a341d55 /dist/B-Deparse | |
parent | 63d690b1f5b7e4a4f5cefe645e21a96651cbe9c2 (diff) | |
download | perl-1c85afcecc8ee030e2780aa5bfa85692c8db64df.tar.gz |
Support for pp_boolkeys in B::Deparse.
Part of "[PATCH] Make if (%hash) {} act the same as if (keys %hash) {}"
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00432.html
which evolved from the approach described in the subject, to instead add a new
opcode pp_boolkeys, to exactly preserve the existing behaviour.
Plus a $VERSION bump.
Diffstat (limited to 'dist/B-Deparse')
-rw-r--r-- | dist/B-Deparse/Deparse.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm index df7ed316c4..fbfee981d7 100644 --- a/dist/B-Deparse/Deparse.pm +++ b/dist/B-Deparse/Deparse.pm @@ -22,7 +22,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED), ($] < 5.009 ? 'PMf_SKIPWHITE' : 'RXf_SKIPWHITE'), ($] < 5.011 ? 'CVf_LOCKED' : ()); -$VERSION = 0.91; +$VERSION = 0.92; use strict; use vars qw/$AUTOLOAD/; use warnings (); @@ -1611,6 +1611,10 @@ sub unop { my($op, $cx, $name) = @_; my $kid; if ($op->flags & OPf_KIDS) { + if (not $name) { + # this deals with 'boolkeys' right now + return $self->deparse($kid,$cx); + } $kid = $op->first; my $builtinname = $name; $builtinname =~ /^CORE::/ or $builtinname = "CORE::$name"; @@ -1655,6 +1659,10 @@ sub pp_chr { maybe_targmy(@_, \&unop, "chr") } sub pp_each { unop(@_, "each") } sub pp_values { unop(@_, "values") } sub pp_keys { unop(@_, "keys") } +sub pp_boolkeys { + # no name because its an optimisation op that has no keyword + unop(@_,""); +} sub pp_aeach { unop(@_, "each") } sub pp_avalues { unop(@_, "values") } sub pp_akeys { unop(@_, "keys") } |