Skip to content

Commit

Permalink
Make Array.splice use IterationBuffer internally
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Feb 24, 2017
1 parent 7010ae9 commit 556db9d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/Array.pm
Expand Up @@ -712,7 +712,7 @@ my class Array { # declared in BOOTSTRAP
)
}

my $nqplist := nqp::list; # for splicing in without values
my $empty := nqp::create(IterationBuffer); # splicing in without values
proto method splice(|) is nodal { * }
#------ splice() candidates
multi method splice(Array:D \SELF:) {
Expand Down Expand Up @@ -787,7 +787,7 @@ my class Array { # declared in BOOTSTRAP
nqp::atpos(nqp::getattr(self,List,'$!reified'),$i))
),
nqp::splice(
nqp::getattr(self,List,'$!reified'),$nqplist,$offset,$size),
nqp::getattr(self,List,'$!reified'),$empty,$offset,$size),
$result
)
}
Expand Down Expand Up @@ -871,7 +871,7 @@ my class Array { # declared in BOOTSTRAP
nqp::stmts(
(my $result := self!splice-save($offset,$size,my int $removed)),
nqp::splice(
nqp::getattr(self,List,'$!reified'),$nqplist,$offset,$removed),
nqp::getattr(self,List,'$!reified'),$empty,$offset,$removed),
$result
)
}
Expand Down Expand Up @@ -987,7 +987,8 @@ my class Array { # declared in BOOTSTRAP
nqp::elems(nqp::if(
nqp::getattr(self,List,'$!reified').DEFINITE,
nqp::getattr(self,List,'$!reified'),
nqp::bindattr(self,List,'$!reified',nqp::list)
nqp::bindattr(self,List,'$!reified',
nqp::create(IterationBuffer))
)),
nqp::unbox_i($offset),
),
Expand Down

0 comments on commit 556db9d

Please sign in to comment.