From: Rick Delaney Date: Thu, 3 Aug 2006 17:30:06 +0000 (-0400) Subject: Re: [perl #40055] B::Deparse double do X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=31c6271a6b2e9136294467d8fc9fb37b41f7ab87;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #40055] B::Deparse double do Message-ID: <20060803213006.GU21381@localhost.localdomain> p4raw-id: //depot/perl@28656 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 6bb2f68..8764113 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -2674,6 +2674,10 @@ sub pp_null { return $self->pp_list($op, $cx); } elsif ($op->first->name eq "enter") { return $self->pp_leave($op, $cx); + } elsif ($op->first->name eq "leave") { + return $self->pp_leave($op->first, $cx); + } elsif ($op->first->name eq "scope") { + return $self->pp_scope($op->first, $cx); } elsif ($op->targ == OP_STRINGIFY) { return $self->dquote($op, $cx); } elsif (!null($op->first->sibling) and diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index c1fa6c2..02ea83c 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -24,7 +24,7 @@ use warnings; use strict; use Config; -print "1..40\n"; +print "1..42\n"; use B::Deparse; my $deparse = B::Deparse->new() or print "not "; @@ -63,13 +63,12 @@ while () { } else { my $deparsed = $deparse->coderef2text( $coderef ); - my $regex = quotemeta($expected); - do { - no warnings 'misc'; - $regex =~ s/\s+/\s+/g; - }; + my $regex = $expected; + $regex =~ s/(\S+)/\Q$1/g; + $regex =~ s/\s+/\\s+/g; + $regex = '^\{\s*' . $regex . '\s*\}$'; - my $ok = ($deparsed =~ /^\{\s*$regex\s*\}$/); + my $ok = ($deparsed =~ /$regex/); print (($ok ? "ok " : "not ok ") . $i++ . "\n"); if (!$ok) { print "# EXPECTED:\n"; @@ -324,3 +323,9 @@ print $_ foreach (reverse 1, 2..5); # 34 (bug #38684) our @ary; @ary = split(' ', 'foo', 0); +#### +# 35 (bug #40055) +do { () }; +#### +# 36 (ibid.) +do { my $x = 1; $x };