diff options
author | Florian Ragwitz <rafl@debian.org> | 2008-01-08 20:56:47 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-01-09 09:55:33 +0000 |
commit | 9210de830a7fbd3725bfbe339a3123439f97aa5d (patch) | |
tree | 84b6c9d539981b29b044eb7e15659afcbcba7850 /ext/B | |
parent | 1515bec64143d124d61662e88e4dc5160e2ea6d7 (diff) | |
download | perl-9210de830a7fbd3725bfbe339a3123439f97aa5d.tar.gz |
B::Deparse fixes for implicit smartmatching in given/when
Message-ID: <20080108185647.GD11813@perldition.org>
p4raw-id: //depot/perl@32909
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/B/Deparse.pm | 2 | ||||
-rw-r--r-- | ext/B/t/deparse.t | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 82307553a0..047205799f 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -2115,7 +2115,7 @@ sub pp_aassign { binop(@_, "=", 7, SWAP_CHILDREN | LIST_CONTEXT) } 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); diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index a85e5cef7e..c2482b968a 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -27,7 +27,7 @@ BEGIN { require feature; feature->import(':5.10'); } -use Test::More tests => 58; +use Test::More tests => 59; use B::Deparse; my $deparse = B::Deparse->new(); @@ -400,3 +400,11 @@ 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; } +} |