This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "B::Deparse: loopexes have list prec"
authorFather Chrysostomos <sprout@cpan.org>
Sun, 17 Jun 2012 20:18:55 +0000 (13:18 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 17 Jun 2012 20:18:55 +0000 (13:18 -0700)
This reverts commit 6a31dbf44ee919c340a3372c95b28d581979d165.

It turns out to be wrong.  Loopexes do have low precedence, but not
as low as I thought.  Their precedence level is actually their own,
undocumented in perlop:

diff --git a/pod/perlop.pod b/pod/perlop.pod
index 3edeabd..c9a1adf 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -49,6 +49,7 @@ values only, not array values.
     nonassoc   ..  ...
     right      ?:
     right      = += -= *= etc.
+    nonassoc   loop exits (last, next, goto)
     left       , =>
     nonassoc   list operators (rightward)
     right      not

I am reverting this for now, till we decide what it is that
needs fixing.

dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/core.t
dist/B-Deparse/t/deparse.t

index ce4bbda..f2bd0b6 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, 5)) =~ s/^\cS//;
+       (my $kid = $self->deparse($op->first, 16)) =~ s/^\cS//;
        $name .= " $kid";
     }
-    return $self->maybe_parens($name, $cx, 5);
+    return $self->maybe_parens($name, $cx, 16);
 }
 
 sub pp_last { loopex(@_, "last") }
index de8d280..62ff862 100644 (file)
@@ -74,7 +74,7 @@ sub CORE_test {
       $deparse->coderef2text(
          eval "no strict 'vars'; sub { () = $expr }" or die "$@in $expr"
       ),
-      qr/\bCORE::$keyword.*[);]/,
+      qr/\sCORE::$keyword.*;/,
       $name||$keyword  
 }
 
index e81c17c..5085a5e 100644 (file)
@@ -1145,13 +1145,6 @@ $_ = ($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;