Permalink
Browse files

Fix for RT #130439

I think we actually only need 1 candidate to handle .splice(Range).
Which I have now added.  It won't be the fastest route of doing this
as it it just a front-end for .slice(offset,size).
  • Loading branch information...
lizmat committed Jan 18, 2017
1 parent 93b0ffa commit 76f14a5c1f55b73d3e1849e813fbe139c1d4fcc1
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/Array.pm
View
@@ -813,6 +813,12 @@ my class Array { # declared in BOOTSTRAP
self.splice # offset 0, take the quick route out
)
}
multi method splice(Array:D: Range:D $range) {
nqp::if(
((my int $low, my int $high) = $range.int-bounds),
self.splice($low, nqp::add_i(nqp::sub_i($high,$low),1))
)
}
method !splice-offset(int $offset) {
nqp::stmts(
(my int $elems = nqp::elems(nqp::getattr(self,List,'$!reified'))),

0 comments on commit 76f14a5

Please sign in to comment.