Change 17898 by rgs@rgs-home on 2002/09/11 20:58:46

        Fix bug #17006 : remove spurious do{} in the deparsing
        of s/.../.../e.

Affected files ...

.... //depot/perl/ext/B/B/Deparse.pm#124 edit
.... //depot/perl/ext/B/t/deparse.t#6 edit

Differences ...

==== //depot/perl/ext/B/B/Deparse.pm#124 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm#123~17887~  Mon Sep  9 14:00:08 2002
+++ perl/ext/B/B/Deparse.pm     Wed Sep 11 13:58:46 2002
@@ -2418,7 +2418,7 @@
 
 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 @@
                                   . $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 @@
            $flags .= "e";
        }
        if ($op->pmflags & PMf_EVAL) {
-           $repl = $self->deparse($repl, 0);
+           $repl = $self->deparse($repl, 0, 1);
        } else {
            $repl = $self->dq($repl);   
        }

==== //depot/perl/ext/B/t/deparse.t#6 (text) ====
Index: perl/ext/B/t/deparse.t
--- perl/ext/B/t/deparse.t#5~16882~     Thu May 30 06:29:13 2002
+++ perl/ext/B/t/deparse.t      Wed Sep 11 13:58:46 2002
@@ -15,7 +15,7 @@
 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 @@
 ####
 # 14
 my $foo = "Ab\x{100}\200\x{200}\377Cd\000Ef\x{1000}\cA\x{2000}\cZ";
+####
+# 15
+s/x/'y';/e;
End of Patch.

Reply via email to