Change 33151 by [EMAIL PROTECTED] on 2008/01/31 12:07:14

        Integrate:
        [ 32869]
        Fix bug #49298: B::Deparse fails to deparse a reference to an anonymous 
hash
        
        [ 32909]
        Subject: [PATCH] B::Deparse fixes for implicit smartmatching in 
given/when
        From: Florian Ragwitz <[EMAIL PROTECTED]>
        Date: Tue, 8 Jan 2008 19:56:47 +0100
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.10/perl/ext/B/B/Deparse.pm#3 integrate
... //depot/maint-5.10/perl/ext/B/t/deparse.t#3 integrate

Differences ...

==== //depot/maint-5.10/perl/ext/B/B/Deparse.pm#3 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm#2~33126~    2008-01-30 07:26:23.000000000 -0800
+++ perl/ext/B/B/Deparse.pm     2008-01-31 04:07:14.000000000 -0800
@@ -21,7 +21,7 @@
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED),
         ($] < 5.009 ? 'PMf_SKIPWHITE' : 'RXf_SKIPWHITE');
-$VERSION = 0.84;
+$VERSION = 0.85;
 use strict;
 use vars qw/$AUTOLOAD/;
 use warnings ();
@@ -1826,9 +1826,7 @@
     my $kid = $op->first;
     if ($kid->name eq "null") {
        $kid = $kid->first;
-       if ($kid->name eq "anonlist" || $kid->name eq "anonhash") {
-           return $self->anon_hash_or_list($op, $cx);
-       } elsif (!null($kid->sibling) and
+       if (!null($kid->sibling) and
                 $kid->sibling->name eq "anoncode") {
             return $self->e_anoncode({ code => 
$self->padval($kid->sibling->targ) });
        } elsif ($kid->name eq "pushmark") {
@@ -2117,7 +2115,7 @@
 sub pp_smartmatch {
     my ($self, $op, $cx) = @_;
     if ($op->flags & OPf_SPECIAL) {
-       return $self->deparse($op->first, $cx);
+       return $self->deparse($op->last, $cx);
     }
     else {
        binop(@_, "~~", 14);

==== //depot/maint-5.10/perl/ext/B/t/deparse.t#3 (text) ====
Index: perl/ext/B/t/deparse.t
--- perl/ext/B/t/deparse.t#2~33126~     2008-01-30 07:26:23.000000000 -0800
+++ perl/ext/B/t/deparse.t      2008-01-31 04:07:14.000000000 -0800
@@ -27,7 +27,7 @@
     require feature;
     feature->import(':5.10');
 }
-use Test::More tests => 57;
+use Test::More tests => 59;
 
 use B::Deparse;
 my $deparse = B::Deparse->new();
@@ -395,3 +395,16 @@
 # 50 keys @array; values @array
 keys @$a if keys @ARGV;
 values @ARGV if values @$a;
+####
+my $a = {};
+my $b = \{};
+my $c = [];
+my $d = \[];
+####
+# SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl 
version"
+# 51 implicit smartmatch in given/when
+given ('foo') {
+    when ('bar') { continue; }
+    when ($_ ~~ 'quux') { continue; }
+    default { 0; }
+}
End of Patch.

Reply via email to