Fix bug #17006 : remove spurious do{} in the deparsing
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 11 Sep 2002 20:58:46 +0000 (20:58 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 11 Sep 2002 20:58:46 +0000 (20:58 +0000)
of s/.../.../e.

p4raw-id: //depot/perl@17898

ext/B/B/Deparse.pm
ext/B/t/deparse.t

index 8d976af..b54a5af 100644 (file)
@@ -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);   
        }
index 1c148e6..ce133d0 100644 (file)
@@ -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;