Permalink
Browse files

List.values always returns a List that may be mutated separately from…

… the invocant.
  • Loading branch information...
1 parent a3b6fa8 commit 8ab5600ec37a94602f81f602b0b35ff60657067c @pmichaud pmichaud committed Jul 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/core/List.pm
View
4 src/core/List.pm
@@ -342,7 +342,9 @@ my class List does Positional {
(0..self.end).list;
}
method values(List:D:) {
- self
+ my Mu $rpa := nqp::clone(nqp::p6listitems(self));
+ nqp::push($rpa, $!nextiter) if $!nextiter.defined;
+ nqp::p6list($rpa, List, self.flattens);
}
method pairs(List:D:) {
self.keys.map: {; $_ => self.at_pos($_) };

0 comments on commit 8ab5600

Please sign in to comment.