Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement rindex with parrots new rindex opcodes
bump NQP revision to something that requires a new enough parrot
  • Loading branch information
moritz committed May 10, 2012
1 parent 9a49814 commit 128e996
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/core/Cool.pm
Expand Up @@ -132,11 +132,18 @@ my class Cool {
?? $pos
!! self.chars;
}
my $result =
nqp::p6box_i(
pir::box__PS(nqp::unbox_s(self.Str)).reverse_index(
my $result = $pos.defined
?? nqp::p6box_i(
pir::rindex__ISSI(
nqp::unbox_s(self.Str),
nqp::unbox_s($needle.Str),
nqp::unbox_i(($pos // 0).Int)));
nqp::unbox_i($pos.Int)
))
!! nqp::p6box_i(
pir::rindex__ISS(
nqp::unbox_s(self.Str),
nqp::unbox_s($needle.Str),
));
fail "substring not found" if $result < 0;
$result;
}
Expand Down
2 changes: 1 addition & 1 deletion tools/build/NQP_REVISION
@@ -1 +1 @@
2012.04.1-13-g88f00e1
2012.04.1-17-g17cc549

0 comments on commit 128e996

Please sign in to comment.