Skip to content

Commit

Permalink
Make sure Map / Array type objects iterarize / list ok
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Feb 21, 2021
1 parent 733c7f1 commit 6b83135
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core.c/Array.pm6
Expand Up @@ -171,7 +171,7 @@ my class Array { # declared in BOOTSTRAP

method is-lazy() { $!todo.DEFINITE && $!todo.is-lazy }
}
method iterator(Array:D: --> Iterator:D) {
multi method iterator(Array:D: --> Iterator:D) {
nqp::isconcrete(nqp::getattr(self,List,'$!todo'))
?? Todo.new(self) # something to iterate over
!! nqp::isconcrete(nqp::getattr(self,List,'$!reified'))
Expand Down
4 changes: 2 additions & 2 deletions src/core.c/Map.pm6
Expand Up @@ -198,9 +198,9 @@ my class Map does Iterable does Associative { # declared in BOOTSTRAP
)
}
}
method iterator(Map:D: --> Iterator:D) { Iterate.new(self) }

method list(Map:D: --> List:D) { self.List }
multi method iterator(Map:D: --> Iterator:D) { Iterate.new(self) }
multi method list(Map:D: --> List:D) { self.List }

multi method pairs(Map:D: --> Seq:D) {
Seq.new(self.iterator)
Expand Down

0 comments on commit 6b83135

Please sign in to comment.