Skip to content

Commit

Permalink
Remove .pop's "is rw" and fix the fallout from unshift's use of that
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jul 4, 2013
1 parent 9ece8b4 commit 68301a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/List.pm
Expand Up @@ -170,7 +170,7 @@ my class List does Positional {
}
}

method pop() is rw {
method pop() {
fail 'Cannot .pop from an infinite list' if self.infinite; #MMD?
my $elems = self.elems;
$elems > 0
Expand Down Expand Up @@ -232,11 +232,12 @@ my class List does Positional {
!! fail 'Element shifted from empty list';
}

my method pop_rw() is rw { nqp::pop($!items) };
multi method unshift(List:D: *@elems) {
fail 'Cannot .unshift an infinite list' if @elems.infinite;
nqp::p6listitems(self);
while @elems {
nqp::unshift($!items, @elems.pop)
nqp::unshift($!items, @elems.pop_rw)
}
self
}
Expand Down

0 comments on commit 68301a7

Please sign in to comment.