Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for #126293
For some reason, the "once" block was fired for *every* time a
pull-one was called.  Also very unclear why the tests didn't spot this.
Weird.
  • Loading branch information
lizmat committed Oct 8, 2015
1 parent 651e17c commit f3aace1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/Any-iterable-methods.pm
Expand Up @@ -940,7 +940,7 @@ augment class Any {
has Mu $!iter;
has &!as;
has &!with;
has $!last;
has $!last = IterationEnd; # can never match real value
method BUILD(\list, &!as, &!with) {
$!iter = as-iterable(list).iterator;
self
Expand All @@ -953,7 +953,6 @@ augment class Any {
my $which;
until ($value := $!iter.pull-one) =:= IterationEnd {
$which = &!as($value);
once { $!last = $which; return $value }
unless with($which,$!last) {
$!last = $which;
return $value;
Expand All @@ -980,7 +979,7 @@ augment class Any {
Seq.new(class :: does Iterator {
has Mu $!iter;
has &!with;
has $!last;
has $!last = IterationEnd; # can never match real value
method BUILD(\list, &!with) {
$!iter = as-iterable(list).iterator;
self
Expand All @@ -989,7 +988,6 @@ augment class Any {
method pull-one() {
my Mu $value;
until ($value := $!iter.pull-one) =:= IterationEnd {
once { $!last = $value; return $value }
unless with($value,$!last) {
$!last = $value;
return $value;
Expand Down

0 comments on commit f3aace1

Please sign in to comment.