Skip to content

Commit

Permalink
Propagate laziness in KeyValue/Pair Iterators
Browse files Browse the repository at this point in the history
Propagate the laziness value from the base iterator used.

Otherwise using .kv, .pairs, or .antipairs on a lazy list would cause it
to be eagerly evaluated.
  • Loading branch information
jstuder-gh committed Jul 11, 2019
1 parent af10886 commit abbd128
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/Rakudo/Iterator.pm6
Expand Up @@ -500,6 +500,7 @@ class Rakudo::Iterator {
target.push(Pair.new(pulled,+($key = nqp::add_i($key,1))))
)
}
method is-lazy() { $!iter.is-lazy }
}
method AntiPair(\iterator) { AntiPair.new(iterator) }

Expand Down Expand Up @@ -2037,6 +2038,7 @@ class Rakudo::Iterator {
)
)
}
method is-lazy() { $!iter.is-lazy }
}
method KeyValue(\iterator) { KeyValue.new(iterator) }

Expand Down Expand Up @@ -2504,6 +2506,7 @@ class Rakudo::Iterator {
target.push(Pair.new(($key = nqp::add_i($key,1)),$pulled))
)
}
method is-lazy() { $!iter.is-lazy }
}
method Pair(\iterator) { PairIterator.new(iterator) }

Expand Down

0 comments on commit abbd128

Please sign in to comment.