This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix deparsing of (1,2,3) in void context
authorFather Chrysostomos <sprout@cpan.org>
Mon, 8 Dec 2014 01:24:50 +0000 (17:24 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 8 Dec 2014 01:25:05 +0000 (17:25 -0800)
This was broken in v5.21.5-289-g12cea2f.  We were trying to check the
kid op of an ex-const, but an ex-const has no children.

lib/B/Deparse.pm
lib/B/Deparse.t

index 446deb1..a62e101 100644 (file)
@@ -3271,7 +3271,8 @@ sub pp_list {
            }
        } elsif ($lopname =~ /^(?:gv|rv2)([ash])v$/
                        && $loppriv & OPpOUR_INTRO
            }
        } elsif ($lopname =~ /^(?:gv|rv2)([ash])v$/
                        && $loppriv & OPpOUR_INTRO
-               or $lopname eq "null" && $lop->first->name eq "gvsv"
+               or $lopname eq "null" && class($lop) eq 'UNOP'
+                       && $lop->first->name eq "gvsv"
                        && $lop->first->private & OPpOUR_INTRO) { # our()
            my $newlocal = "local " x !!($loppriv & OPpLVAL_INTRO) . "our";
            ($local = "", last)
                        && $lop->first->private & OPpOUR_INTRO) { # our()
            my $newlocal = "local " x !!($loppriv & OPpLVAL_INTRO) . "our";
            ($local = "", last)
index 1c3e50b..0bb129e 100644 (file)
@@ -469,6 +469,14 @@ tr/\x{345}/\x{370}/;
     2;
 }
 ####
     2;
 }
 ####
+# List of constants in void context
+# CONTEXT no warnings;
+(1,2,3);
+0;
+>>>>
+'???', '???', '???';
+0;
+####
 # Lexical and simple arithmetic
 my $test;
 ++$test and $test /= 2;
 # Lexical and simple arithmetic
 my $test;
 ++$test and $test /= 2;