Skip to content

Commit

Permalink
B::Deparse now handles n-at-a-time for.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwc10 committed Sep 22, 2021
1 parent 803bb80 commit 8b7aa8e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/B/Deparse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
MDEREF_SHIFT
);

$VERSION = '1.58';
$VERSION = '1.59';
use strict;
our $AUTOLOAD;
use warnings ();
Expand Down Expand Up @@ -3954,7 +3954,18 @@ sub loop_common {
} else {
$ary = $self->deparse($ary, 1);
}
if (null $var) {
my $iter_targ = $kid->first->first->targ;
if ($iter_targ) {
# for my ($foo, $bar) () stores the count (less 1) in the targ of
# the ITER op.
my @vars;
my $targ = $enter->targ;
while ($iter_targ-- >= 0) {
push @vars, $self->padname_sv($targ)->PVX;
++$targ;
}
$var = 'my (' . join(', ', @vars) . ')';
} elsif (null $var) {
$var = $self->pp_padsv($enter, 1, 1);
} elsif ($var->name eq "rv2gv") {
$var = $self->pp_rv2sv($var, 1);
Expand Down
10 changes: 10 additions & 0 deletions lib/B/Deparse.t
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,16 @@ foreach \&a (sub { 9; } , sub { 10; } ) {
die;
}
####
my %hash;
foreach my ($key, $value) (%hash) {
study $_;
}
####
my @ducks;
foreach my ($tick, $trick, $track) (@ducks) {
study $_;
}
####
# join $foo, pos
my $foo;
$_ = join $foo, pos
Expand Down

0 comments on commit 8b7aa8e

Please sign in to comment.