From: Rafael Garcia-Suarez Date: Wed, 11 Sep 2002 20:58:46 +0000 (+0000) Subject: Fix bug #17006 : remove spurious do{} in the deparsing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ae52e81fe7aafb05ef5b0f7a9432bf165b26362;p=p5sagit%2Fp5-mst-13.2.git Fix bug #17006 : remove spurious do{} in the deparsing of s/.../.../e. p4raw-id: //depot/perl@17898 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 8d976af..b54a5af 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -2418,7 +2418,7 @@ BEGIN { eval "sub OP_LIST () {" . opnumber("list") . "}" } sub pp_null { my $self = shift; - my($op, $cx) = @_; + my($op, $cx, $flags) = @_; if (class($op) eq "OP") { # old value is lost return $self->{'ex_const'} if $op->targ == OP_CONST; @@ -2441,7 +2441,12 @@ sub pp_null { . $self->deparse($op->first->sibling, 20), $cx, 20); } elsif ($op->flags & OPf_SPECIAL && $cx == 0 && !$op->targ) { - return "do {\n\t". $self->deparse($op->first, $cx) ."\n\b};"; + if ($flags) { + return $self->deparse($op->first, $cx); + } + else { + return "do {\n\t". $self->deparse($op->first, $cx) ."\n\b};"; + } } elsif (!null($op->first->sibling) and $op->first->sibling->name eq "null" and class($op->first->sibling) eq "UNOP" and @@ -3735,7 +3740,7 @@ sub pp_subst { $flags .= "e"; } if ($op->pmflags & PMf_EVAL) { - $repl = $self->deparse($repl, 0); + $repl = $self->deparse($repl, 0, 1); } else { $repl = $self->dq($repl); } diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index 1c148e6..ce133d0 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -15,7 +15,7 @@ use warnings; use strict; use Config; -print "1..17\n"; +print "1..18\n"; use B::Deparse; my $deparse = B::Deparse->new() or print "not "; @@ -193,3 +193,6 @@ $_ .= . <$foo>; #### # 14 my $foo = "Ab\x{100}\200\x{200}\377Cd\000Ef\x{1000}\cA\x{2000}\cZ"; +#### +# 15 +s/x/'y';/e;