Skip to content

Commit

Permalink
Fix issue with HyperToIterator.skip-at-least
Browse files Browse the repository at this point in the history
The $!current-items may already have items that we need to skip.  So
get any new items *after* we have skipped any from the current items.
  • Loading branch information
lizmat committed Mar 20, 2018
1 parent 34b294d commit ae0cbc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Rakudo/Internals/HyperToIterator.pm6
Expand Up @@ -72,13 +72,13 @@ my class Rakudo::Internals::HyperToIterator does Rakudo::Internals::HyperJoiner
method skip-at-least(int $skipping) {
my int $toskip = $skipping;
while $toskip {
$!current-items := $!batches.receive.items;
self.batch-used();
if nqp::isge_i(nqp::elems($!current-items),$toskip) {
nqp::splice($!current-items,EMPTY_BUFFER,0,$toskip);
return 1;
}
$toskip = nqp::sub_i($toskip,nqp::elems($!current-items));
$!current-items := $!batches.receive.items;
self.batch-used();

CATCH {
when X::Channel::ReceiveOnClosed {
Expand Down

0 comments on commit ae0cbc3

Please sign in to comment.