diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-09 12:55:46 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 14:26:45 -0700 |
commit | 5f4d8496a56b55ca11a6acd0e53a4db9b550f186 (patch) | |
tree | cdb03cbfe0bcf94cdfd18220afdc7c1e960e9b6d /lib | |
parent | 2e1731446cd265cddae2ea6c43a375168fdb6f56 (diff) | |
download | perl-5f4d8496a56b55ca11a6acd0e53a4db9b550f186.tar.gz |
Deparse local our LIST
The ‘local’ was being omitted. I missed the list form of
‘local our’ in commit f351564117.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Deparse.pm | 21 | ||||
-rw-r--r-- | lib/B/Deparse.t | 1 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 76c6cc4b9c..2c825905da 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3048,7 +3048,8 @@ sub pp_list { # known to take the OPpLVAL_INTRO flag. my $lopname = $lop->name; - if (!($lop->private & (OPpLVAL_INTRO|OPpOUR_INTRO) + my $loppriv = $lop->private; + if (!($loppriv & (OPpLVAL_INTRO|OPpOUR_INTRO) or $lopname eq "undef") or $lopname =~ /^(?:entersub|exit|open|split)\z/) { @@ -3057,11 +3058,11 @@ sub pp_list { } my $newtype; if ($lopname =~ /^pad[ash]v$/) { - if ($lop->private & OPpPAD_STATE) { # state() - ($local = "", last) if $local =~ /^(?:local|our|my)$/; + if ($loppriv & OPpPAD_STATE) { # state() + ($local = "", last) if $local !~ /^(?:either|state)$/; $local = "state"; } else { # my() - ($local = "", last) if $local =~ /^(?:local|our|state)$/; + ($local = "", last) if $local !~ /^(?:either|my)$/; $local = "my"; } my $padname = $self->padname_sv($lop->targ); @@ -3069,11 +3070,13 @@ sub pp_list { $newtype = $padname->SvSTASH->NAME; } } elsif ($lopname =~ /^(?:gv|rv2)([ash])v$/ - && $lop->private & OPpOUR_INTRO + && $loppriv & OPpOUR_INTRO or $lopname eq "null" && $lop->first->name eq "gvsv" && $lop->first->private & OPpOUR_INTRO) { # our() - ($local = "", last) if $local =~ /^(?:my|local|state)$/; - $local = "our"; + my $newlocal = "local " x !!($loppriv & OPpLVAL_INTRO) . "our"; + ($local = "", last) + if $local ne 'either' && $local ne $newlocal; + $local = $newlocal; my $funny = !$1 || $1 eq 's' ? '$' : $1 eq 'a' ? '@' : '%'; if (my $t = $self->find_our_type( $funny . $self->gv_or_padgv($lop->first)->NAME @@ -3086,7 +3089,7 @@ sub pp_list { && !($lopname eq 'sort' && ($lop->flags & OPpSORT_REVERSE))) { # local() - ($local = "", last) if $local =~ /^(?:my|our|state)$/; + ($local = "", last) if $local !~ /^(?:either|local)$/; $local = "local"; } if (defined $type && defined $newtype && $newtype ne $type) { @@ -3096,7 +3099,7 @@ sub pp_list { $type = $newtype; } $local = "" if $local eq "either"; # no point if it's all undefs - $local &&= $self->keyword($local); + $local &&= join ' ', map $self->keyword($_), split / /, $local; $local .= " $type " if $local && length $type; return $self->deparse($kid, $cx) if null $kid->sibling and not $local; for (; !null($kid); $kid = $kid->sibling) { diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 61a2009b86..d1b461d427 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -396,6 +396,7 @@ state Dog ($fough, @barre, %bazze); #### # local our local our $rhubarb; +local our($rhu, $barb); #### # <> my $foo; |