Skip to content

Commit

Permalink
Kill the last use of List.ensure-allocated
Browse files Browse the repository at this point in the history
And the method itself with it.  This means that now all List methods
know how to handle the case when no $!reified attribute has been
initialized, without allocating one just to be on the safe side
(which is what ensure-allocated did).
  • Loading branch information
lizmat committed Jul 9, 2016
1 parent a885088 commit 405519a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/List.pm
Expand Up @@ -365,10 +365,6 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
list
}

method !ensure-allocated(--> Nil) {
$!reified := nqp::create(IterationBuffer) unless $!reified.DEFINITE;
}

multi method Bool(List:D:) {
nqp::p6bool(
nqp::unless(
Expand Down Expand Up @@ -1095,10 +1091,14 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
}

method rotor(List:D: *@cycle, :$partial) is nodal {
self!ensure-allocated;
die "Must specify *how* to rotor a List"
unless @cycle.is-lazy || @cycle;

# done if there's nothing to rotor on
return Rakudo::Internals.EmptyIterator
unless nqp::getattr(self,List,'$!reified').DEFINITE
|| nqp::getattr(self,List,'$!todo').DEFINITE;

my $finished = 0;
# (Note, the xx should be harmless if the cycle is already infinite by accident.)
my @c := @cycle.is-lazy ?? @cycle !! (@cycle xx *).cache;
Expand Down

0 comments on commit 405519a

Please sign in to comment.