Skip to content

Commit

Permalink
Make List:D.iterator a multi
Browse files Browse the repository at this point in the history
So that List.iterator will produce an iterator producing List, rather
than die-ing.
  • Loading branch information
lizmat committed Nov 2, 2022
1 parent a98f1ca commit 5ad2c0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.c/List.pm6
Expand Up @@ -644,7 +644,7 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP

method is-lazy() { $!todo.DEFINITE && $!todo.is-lazy }
}
method iterator(List:D: --> Iterator:D) {
multi method iterator(List:D: --> Iterator:D) {
nqp::isconcrete($!todo)
?? Todo.new(self) # something to iterate in the future
!! nqp::isconcrete($!reified) # everything we need is already there
Expand Down

0 comments on commit 5ad2c0c

Please sign in to comment.