Skip to content
Permalink
Browse files

s/IterationBuffer.new/nqp::create(IterationBuffer)/

IterationBuffers are a low level thing.  There is no need to go through
the whole Mu.new code path to create an IterationBuffer.
  • Loading branch information...
lizmat committed Oct 9, 2018
1 parent 8c10da6 commit 84311b77a2a104625587891bb270f5c83858484a
@@ -1451,7 +1451,8 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
multi method sort() {
nqp::if(
nqp::eqaddr(
self.iterator.push-until-lazy(my \buf := IterationBuffer.new),
self.iterator.push-until-lazy(
my \buf := nqp::create(IterationBuffer)),
IterationEnd
),
Seq.new(
@@ -1466,7 +1467,8 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
nqp::stmts(
nqp::unless(
nqp::eqaddr(
self.iterator.push-until-lazy(my \buf := IterationBuffer.new),
self.iterator.push-until-lazy(
my \buf := nqp::create(IterationBuffer)),
IterationEnd
),
X::Cannot::Lazy.new(:action<sort>).throw
@@ -1151,7 +1151,7 @@ my class Array { # declared in BOOTSTRAP
method !splice-offset-size-new(int $offset,int $size,@new) {
nqp::if(
nqp::eqaddr(@new.iterator.push-until-lazy(
(my $new := IterationBuffer.new)),IterationEnd),
(my $new := nqp::create(IterationBuffer))),IterationEnd),
nqp::if( # reified all values to splice in
(nqp::isnull($!descriptor) || nqp::eqaddr(self.of,Mu)),
nqp::stmts( # no typecheck needed
@@ -1592,7 +1592,7 @@ my class Rakudo::Internals {

my \result := CoreMap.new(op, iterable.iterator, $deep);
my \type := nqp::istype(obj, List) ?? obj.WHAT !! List; # keep subtypes of List
my \buffer := IterationBuffer.new;
my \buffer := nqp::create(IterationBuffer);
result.push-all(buffer);
my \retval := type.new;
nqp::bindattr(retval, List, '$!reified', buffer);
@@ -1473,7 +1473,7 @@ class Rakudo::Iterator {
has int $!i;
method !SET-SELF(\source) {
$!source := source;
$!buffer := IterationBuffer.new;
$!buffer := nqp::create(IterationBuffer);
self
}
method new(\source) { nqp::create(self)!SET-SELF(source) }
@@ -199,9 +199,9 @@ sub MD-HASH-SLICE-ONE-POSITION(\SELF, \indices, \idx, int $dim, \target) {
}

multi sub postcircumfix:<{; }>(\SELF, @indices) {
my \target = IterationBuffer.new;
my \target = nqp::create(IterationBuffer);
MD-HASH-SLICE-ONE-POSITION(SELF, @indices, @indices.AT-POS(0), 0, target);
nqp::p6bindattrinvres(nqp::create(List), List, '$!reified', target)
target.List
}

multi sub postcircumfix:<{; }>(\SELF, @indices, :$exists!) {
@@ -609,7 +609,7 @@ multi sub HYPER(&operator, Iterable:D \left, Iterable:D \right, :$dwim-left, :$d
my \lefti := Rakudo::Iterator.DWIM(left-iterator);
my \righti := Rakudo::Iterator.DWIM(right-iterator);

my \result := IterationBuffer.new;
my \result := nqp::create(IterationBuffer);
loop {
my \leftv := lefti.pull-one;
my \rightv := righti.pull-one;
@@ -47,9 +47,9 @@ sub MD-ARRAY-SLICE-ONE-POSITION(\SELF, \indices, \idx, int $dim, \target) is raw
}
}
sub MD-ARRAY-SLICE(\SELF, @indices) is raw {
my \target = IterationBuffer.new;
my \target = nqp::create(IterationBuffer);
MD-ARRAY-SLICE-ONE-POSITION(SELF, @indices, @indices.AT-POS(0), 0, target);
nqp::p6bindattrinvres(nqp::create(List), List, '$!reified', target)
target.List
}

multi sub postcircumfix:<[; ]>(\SELF, @indices) is raw {

0 comments on commit 84311b7

Please sign in to comment.
You can’t perform that action at this time.