Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix exception handlers in main program body.
These would previously fail to actually catch the exception. Resolves
RT#116056.
  • Loading branch information
jnthn committed Jan 12, 2015
1 parent 8ceebf5 commit 0a99f9f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/Perl6/Actions.nqp
Expand Up @@ -261,7 +261,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $unit := $*UNIT;
my $mainline := QAST::Stmts.new(
$*POD_PAST,
$<statementlist>.ast,
statementlist_with_handlers($/)
);

if %*COMPILING<%?OPTIONS><p> { # also covers the -np case, like Perl 5
Expand Down Expand Up @@ -911,14 +911,7 @@ class Perl6::Actions is HLL::Actions does STDActions {

method blockoid($/) {
if $<statementlist> {
my $past := $<statementlist>.ast;
if %*HANDLERS {
$past := QAST::Op.new( :op('handle'), $past );
for %*HANDLERS {
$past.push($_.key);
$past.push($_.value);
}
}
my $past := statementlist_with_handlers($/);
my $BLOCK := $*CURPAD;
$BLOCK.blocktype('declaration_static');
$BLOCK.push($past);
Expand All @@ -935,6 +928,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
}

sub statementlist_with_handlers($/) {
my $past := $<statementlist>.ast;
if %*HANDLERS {
$past := QAST::Op.new( :op('handle'), $past );
for %*HANDLERS {
$past.push($_.key);
$past.push($_.value);
}
}
$past
}

method you_are_here($/) {
make self.CTXSAVE();
}
Expand Down

0 comments on commit 0a99f9f

Please sign in to comment.