Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fire FIRST phaser
  • Loading branch information
FROGGS committed Aug 28, 2015
1 parent 0b76e79 commit 15b06d0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/Any-iterable-methods.pm
Expand Up @@ -87,10 +87,19 @@ augment class Any {
# put that on a different code-path to keep the commonest
# case fast.
Seq.new(class :: does MapIterCommon {
has $!did-run;

method pull-one() is rw {
my int $redo = 1;
my $value;
my $result;

unless $!did-run {
nqp::p6setfirstflag(&!block)
if (nqp::can(&!block, 'phasers') && &!block.phasers('FIRST'));
$!did-run = 1;
}

if $!slipping && ($result := self.slip-one()) !=:= IterationEnd {
$result
}
Expand Down Expand Up @@ -134,13 +143,21 @@ augment class Any {
else {
Seq.new(class :: does MapIterCommon {
has $!value-buffer;
has $!did-run;

method pull-one() is rw {
$!value-buffer.DEFINITE
?? nqp::setelems($!value-buffer, 0)
!! ($!value-buffer := IterationBuffer.new);
my int $redo = 1;
my $result;

unless $!did-run {
nqp::p6setfirstflag(&!block)
if (nqp::can(&!block, 'phasers') && &!block.phasers('FIRST'));
$!did-run = 1;
}

if $!slipping && ($result := self.slip-one()) !=:= IterationEnd {
$result
}
Expand Down

0 comments on commit 15b06d0

Please sign in to comment.