Skip to content

Commit

Permalink
nextsame/nextwith should always cause a return
Browse files Browse the repository at this point in the history
Even in the case they have nowhere to go.
  • Loading branch information
jnthn committed Nov 17, 2015
1 parent a662e02 commit 7c6a55e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/core/control.pm
Expand Up @@ -112,11 +112,9 @@ my &callwith := -> |c {

my &nextwith := -> |c {
my Mu $dispatcher := nqp::p6finddispatcher('nextwith');
unless $dispatcher.exhausted {
nqp::p6routinereturn(nqp::p6recont_ro(
$dispatcher.call_with_args(|c)))
}
Nil
nqp::p6routinereturn($dispatcher.exhausted
?? Nil
!! nqp::p6recont_ro($dispatcher.call_with_args(|c)))
};

my &callsame := -> {
Expand All @@ -128,12 +126,10 @@ my &callsame := -> {

my &nextsame := -> {
my Mu $dispatcher := nqp::p6finddispatcher('nextsame');
unless $dispatcher.exhausted {
nqp::p6routinereturn(nqp::p6recont_ro(
$dispatcher.call_with_capture(
nqp::p6routinereturn($dispatcher.exhausted
?? Nil
!! nqp::p6recont_ro($dispatcher.call_with_capture(
nqp::p6argsfordispatcher($dispatcher))))
}
Nil
};

my &lastcall := -> --> True {
Expand Down

0 comments on commit 7c6a55e

Please sign in to comment.