Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix handling of lack of candidate to defer to in nextsame/nextwith.
  • Loading branch information
jnthn committed Sep 12, 2011
1 parent e3a2fd7 commit a5d0ca2
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/core/control.pm
Expand Up @@ -100,13 +100,14 @@ my &callwith := -> *@pos, *%named {

my &nextwith := -> *@pos, *%named {
my Mu $dispatcher := pir::perl6_find_dispatcher__P();
my $parcel := $dispatcher.exhausted ?? Nil !!
$dispatcher.call_with_args(|@pos, |%named);
my Mu $return := pir::find_caller_lex__Ps('RETURN');
nqp::isnull($return)
?? die "Attempt to return outside of any Routine"
!! $return(pir::perl6_decontainerize__PP($parcel));
$parcel
my Mu $return := pir::find_caller_lex__Ps('RETURN');
unless $dispatcher.exhausted {
nqp::isnull($return)
?? die "Attempt to return outside of any Routine"
!! $return(pir::perl6_decontainerize__PP(
$dispatcher.call_with_args(|@pos, |%named)))
}
Nil
};

my &callsame := -> {
Expand All @@ -118,14 +119,16 @@ my &callsame := -> {

my &nextsame := -> {
my Mu $dispatcher := pir::perl6_find_dispatcher__P();
my $parcel := $dispatcher.exhausted ?? Nil !!
$dispatcher.call_with_capture(
pir::perl6_args_for_dispatcher__PP($dispatcher));
my Mu $return := pir::find_caller_lex__Ps('RETURN');
nqp::isnull($return)
?? die "Attempt to return outside of any Routine"
!! $return(pir::perl6_decontainerize__PP($parcel));
$parcel
my Mu $return := pir::find_caller_lex__Ps('RETURN');
unless $dispatcher.exhausted {
nqp::isnull($return)
?? die "Attempt to return outside of any Routine"
!! $return(pir::perl6_decontainerize__PP(
$dispatcher.call_with_capture(
pir::perl6_args_for_dispatcher__PP($dispatcher))))

}
Nil
};

my &lastcall := -> {
Expand Down

0 comments on commit a5d0ca2

Please sign in to comment.