summaryrefslogtreecommitdiff
path: root/ext/B
diff options
context:
space:
mode:
Diffstat (limited to 'ext/B')
-rw-r--r--ext/B/B/Deparse.pm2
-rw-r--r--ext/B/t/deparse.t10
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; }
+}