This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
B::Deparse: loopexes have list prec
authorFather Chrysostomos <sprout@cpan.org>
Fri, 8 Jun 2012 21:49:57 +0000 (14:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 8 Jun 2012 23:17:04 +0000 (16:17 -0700)
dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/core.t
dist/B-Deparse/t/deparse.t

index 46af5e4..63a3259 100644 (file)
@@ -2155,10 +2155,10 @@ sub loopex {
     } elsif (class($op) eq "OP") {
        # no-op
     } elsif (class($op) eq "UNOP") {
-       (my $kid = $self->deparse($op->first, 16)) =~ s/^\cS//;
+       (my $kid = $self->deparse($op->first, 5)) =~ s/^\cS//;
        $name .= " $kid";
     }
-    return $self->maybe_parens($name, $cx, 16);
+    return $self->maybe_parens($name, $cx, 5);
 }
 
 sub pp_last { loopex(@_, "last") }
index 62ff862..de8d280 100644 (file)
@@ -74,7 +74,7 @@ sub CORE_test {
       $deparse->coderef2text(
          eval "no strict 'vars'; sub { () = $expr }" or die "$@in $expr"
       ),
-      qr/\sCORE::$keyword.*;/,
+      qr/\bCORE::$keyword.*[);]/,
       $name||$keyword  
 }
 
index 5085a5e..e81c17c 100644 (file)
@@ -1145,6 +1145,13 @@ $_ = ($a xor not +($1 || 2) ** 2);
 () = warn() + 1;
 () = setpgrp() + 1;
 ####
+# loopexes have list prec
+() = (CORE::dump a) | 'b';
+() = (goto a) | 'b';
+() = (last a) | 'b';
+() = (next a) | 'b';
+() = (redo a) | 'b';
+####
 # [perl #63558] open local(*FH)
 open local *FH;
 pipe local *FH, local *FH;