In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/88a758b52cfa650539042289a5f43570c7966a74?hp=2a2626d8512fc09c6ef077095e4e075978a5c2df>
- Log ----------------------------------------------------------------- commit 88a758b52cfa650539042289a5f43570c7966a74 Author: Father Chrysostomos <spr...@cpan.org> Date: Sun Oct 5 06:58:50 2014 -0700 Deparse inverted for(;;) cond more correctly 22584011 did not take the looks-like-a-function rule into account. not ($1 || 2) ** 2 means (not ($1 || 2)) ** 2. M lib/B/Deparse.pm M lib/B/Deparse.t commit 8443930ef427bd0f49cad8c305b1180d62ac503f Author: Father Chrysostomos <spr...@cpan.org> Date: Sun Oct 5 06:34:09 2014 -0700 Deparse.t: Another to-do test for lex subs M lib/B/Deparse.t ----------------------------------------------------------------------- Summary of changes: lib/B/Deparse.pm | 7 +++---- lib/B/Deparse.t | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 68b4667..8d99acc 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3253,10 +3253,9 @@ sub loop_common { $body = $self->deparse($body, 0); } if ($precond) { # for(;;) - $cond &&= $self->deparse($cond, $name eq 'until' ? 3 : 1); - if ($name eq 'until') { - substr $cond, 0, 0, = $cond =~ /^\(/ ? "not" : "not "; - } + $cond &&= $name eq 'until' + ? listop($self, undef, 1, "not", $cond->first) + : $self->deparse($cond, 1); $head = "$precond$cond$postcond"; } if ($name && !$head) { diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 02ed877..ffc2a16 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -412,6 +412,9 @@ for (my $i; not $i;) { for (my $i; not $i; ++$i) { die; } +for (my $a; not +($1 || 2) ** 2;) { + die; +} Something_to_put_the_loop_in_void_context(); #### # while/continue @@ -1451,6 +1454,25 @@ no warnings 'experimental::lexical_subs'; state sub f {} print f(); #### +# SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" +# TODO unimplemented in B::Deparse; RT #116553 +# lexical subroutine scoping +# CONTEXT use feature 'lexical_subs'; no warnings 'experimental::lexical_subs'; +{ + { + my sub a { die; } + { + foo(); + my sub b; + b(); + main::b(); + my $b; + sub b { $b } + } + } + b(); +} +#### # Elements of %# should not be confused with $#{ array } () = ${#}{'foo'}; #### -- Perl5 Master Repository