Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement whatever star cases of splice.
  • Loading branch information
jnthn committed Jan 10, 2013
1 parent 8ca20db commit 099d0ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/List.pm
Expand Up @@ -234,14 +234,14 @@ my class List does Positional {
my $o = $offset;
my $s = $size;
my $elems = self.elems;
$offset += $elems if ($offset < 0);
$o = $o($elems) if nqp::istype($o, Callable);
X::OutOfRange.new(
what => 'offset argument to List.splice',
got => $offset,
range => (-self.elems..^self.elems),
range => (0..^self.elems),
).fail if $o < 0;
$s //= self.elems - ($o min $elems);
$s = self.elems + $s - $o if ($s < 0);
$s = $s(self.elems - $o) if nqp::istype($s, Callable);
X::OutOfRange.new(
what => 'size argument to List.splice',
got => $size,
Expand Down

0 comments on commit 099d0ec

Please sign in to comment.