-
-
Save zoffixznet/98ee33398ac7979c0adc4a4a88696b85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Seq.pm b/src/core/Seq.pm | |
index a7a3c89..1bd8431 100644 | |
--- a/src/core/Seq.pm | |
+++ b/src/core/Seq.pm | |
@@ -231,8 +231,24 @@ my class Seq is Cool does Iterable does PositionalBindFailover { | |
Seq.new(Rakudo::Iterator.CStyleLoop(&body, &cond, &afterwards)) | |
} | |
- multi method skip() { nqp::stmts( $!iter.skip-one, self) } | |
- multi method skip(Int() $n) { nqp::stmts( $!iter.skip-at-least($n), self) } | |
+ multi method skip() { | |
+ nqp::if( | |
+ $!iter.DEFINITE, | |
+ nqp::stmts($!iter.skip-one,self), | |
+ nqp::if( | |
+ $!list.DEFINITE, | |
+ nqp::stmts($!list.iterator.skip-one,self), | |
+ X::Seq::Consumed.new.throw)) | |
+ } | |
+ multi method skip(Int() $n) { | |
+ nqp::if( | |
+ $!iter.DEFINITE, | |
+ nqp::stmts($!iter.skip-at-least($n),self), | |
+ nqp::if( | |
+ $!list.DEFINITE, | |
+ nqp::stmts($!list.iterator.skip-at-least($n),self), | |
+ X::Seq::Consumed.new.throw)) | |
+ } | |
} | |
sub GATHER(&block) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment