diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-09-11 20:58:46 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-09-11 20:58:46 +0000 |
commit | 4ae52e81fe7aafb05ef5b0f7a9432bf165b26362 (patch) | |
tree | 5e8e1f71763eaf9d4805e38938a9f8b2479dc556 /ext/B | |
parent | c1d47b768c58b96f9b0818e42bf40dd6506a4d86 (diff) | |
download | perl-4ae52e81fe7aafb05ef5b0f7a9432bf165b26362.tar.gz |
Fix bug #17006 : remove spurious do{} in the deparsing
of s/.../.../e.
p4raw-id: //depot/perl@17898
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/B/Deparse.pm | 11 | ||||
-rw-r--r-- | ext/B/t/deparse.t | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 8d976afd08..b54a5af97b 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 1c148e602a..ce133d0dff 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 @@ $_ .= <ARGV> . <$foo>; #### # 14 my $foo = "Ab\x{100}\200\x{200}\377Cd\000Ef\x{1000}\cA\x{2000}\cZ"; +#### +# 15 +s/x/'y';/e; |