summaryrefslogtreecommitdiff
path: root/ext/B
diff options
context:
space:
mode:
authorPaul Johnson <paul@pjcj.net>2008-04-19 15:02:06 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-04-19 12:08:35 +0000
commit7ecdd211705c44c1696529960c8ab5c1ad8f4c65 (patch)
tree5ea8e6829d802c24999f84bac980b59fd5980567 /ext/B
parent432fb0a0d3d35f4a3937889f2c65086f2da4cd89 (diff)
downloadperl-7ecdd211705c44c1696529960c8ab5c1ad8f4c65.tar.gz
Re: wrong line numbers in elsif()
Message-ID: <20080419110206.GE32555@pjcj.net> p4raw-id: //depot/perl@33714
Diffstat (limited to 'ext/B')
-rw-r--r--ext/B/B/Deparse.pm6
-rw-r--r--ext/B/t/deparse.t9
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm
index 64c6dc9891..c7ed82d638 100644
--- a/ext/B/B/Deparse.pm
+++ b/ext/B/B/Deparse.pm
@@ -2589,6 +2589,12 @@ sub pp_cond_expr {
my $newcond = $newop->first;
my $newtrue = $newcond->sibling;
$false = $newtrue->sibling; # last in chain is OP_AND => no else
+ if ($newcond->name eq "lineseq")
+ {
+ # lineseq to ensure correct line numbers in elsif()
+ # Bug #37302 fixed by change #33710.
+ $newcond = $newcond->first->sibling;
+ }
$newcond = $self->deparse($newcond, 1);
$newtrue = $self->deparse($newtrue, 0);
push @elsifs, "elsif ($newcond) {\n\t$newtrue\n\b}";
diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t
index 5553df8c89..dce503403e 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 => 59;
+use Test::More tests => 60;
use B::Deparse;
my $deparse = B::Deparse->new();
@@ -409,3 +409,10 @@ given ('foo') {
when ($_ ~~ 'quux') { continue; }
default { 0; }
}
+####
+# 53 conditions in elsifs (regression in change #33710 which fixed bug #37302)
+if ($a) { x(); }
+elsif ($b) { x(); }
+elsif ($a and $b) { x(); }
+elsif ($a or $b) { x(); }
+else { x(); }