Skip to content

Commit

Permalink
Merge 252429d into 7886147
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfsage committed Jun 11, 2021
2 parents 7886147 + 252429d commit f1963c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/B/Deparse.pm
Expand Up @@ -52,7 +52,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
MDEREF_SHIFT
);

$VERSION = '1.56';
$VERSION = '1.57';
use strict;
our $AUTOLOAD;
use warnings ();
Expand Down Expand Up @@ -4072,11 +4072,15 @@ sub pp_leavetrycatch {
$catch->name eq "catch" or die "Expected catch as third child of leavetrycatch";

my $catchblock = $catch->first->sibling;
$catchblock->name eq "scope" or die "Expected scope as second child of catch";
my $name = $catchblock->name;
unless ($name eq "scope" || $name eq "leave") {
die "Expected scope or leave as second child of catch, got $name instead";
}

my $trycode = scopeop(0, $self, $tryblock);
my $catchvar = $self->padname($catch->targ);
my $catchcode = scopeop(0, $self, $catchblock);
my $catchcode = $name eq 'scope' ? scopeop(0, $self, $catchblock)
: scopeop(1, $self, $catchblock);

return "try {\n\t$trycode\n\b}\n" .
"catch($catchvar) {\n\t$catchcode\n\b}\cK";
Expand Down
9 changes: 9 additions & 0 deletions lib/B/Deparse.t
Expand Up @@ -3171,3 +3171,12 @@ try {
catch($var) {
SECOND();
}
####
# CONTEXT use feature 'try'; no warnings 'experimental::try';
try {
FIRST();
}
catch($var) {
my $x;
SECOND();
}

0 comments on commit f1963c9

Please sign in to comment.