summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/B/Deparse.pm22
-rw-r--r--lib/B/Op_private.pm1
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm
index 02ea4bc5f0..fe8abbf4e1 100644
--- a/lib/B/Deparse.pm
+++ b/lib/B/Deparse.pm
@@ -2539,23 +2539,16 @@ sub pp_lock { unop(@_, "lock") }
sub pp_continue { unop(@_, "continue"); }
-sub givwhen {
- my $self = shift;
- my($op, $cx, $givwhen) = @_;
-
+sub pp_leavewhen {
+ my($self, $op, $cx) = @_;
+ my $when = $self->keyword("when");
my $enterop = $op->first;
my $cond = $enterop->first;
my $cond_str = $self->deparse($cond, 1);
my $block = $self->deparse($cond->sibling, 0);
-
- return "$givwhen ($cond_str) {\n".
- "\t$block\n".
- "\b}\cK";
+ return "$when ($cond_str) {\n\t$block\n\b}\cK";
}
-sub pp_leavegiven { givwhen(@_, $_[0]->keyword("given")); }
-sub pp_leavewhen { givwhen(@_, $_[0]->keyword("when")); }
-
sub pp_exists {
my $self = shift;
my($op, $cx) = @_;
@@ -3792,6 +3785,13 @@ sub loop_common {
$bare = 1;
}
$body = $kid;
+ } elsif ($enter->name eq "entergiven") { # given
+ my $given = $self->keyword("given");
+ my $enterop = $op->first;
+ my $topic = $enterop->first;
+ my $topic_str = $self->deparse($topic, 1);
+ my $block = $self->deparse($topic->sibling, 0);
+ return "$given ($topic_str) {\n\t$block\n\b}\cK";
} elsif ($enter->name eq "enteriter") { # foreach
my $ary = $enter->first->sibling; # first was pushmark
my $var = $ary->sibling;
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm
index 5df382a329..4718a25031 100644
--- a/lib/B/Op_private.pm
+++ b/lib/B/Op_private.pm
@@ -405,7 +405,6 @@ $bits{lc}{0} = $bf[0];
$bits{lcfirst}{0} = $bf[0];
@{$bits{le}}{1,0} = ($bf[1], $bf[1]);
$bits{leaveeval}{0} = $bf[0];
-$bits{leavegiven}{0} = $bf[0];
@{$bits{leaveloop}}{1,0} = ($bf[1], $bf[1]);
$bits{leavesub}{0} = $bf[0];
$bits{leavesublv}{0} = $bf[0];