Permalink
Browse files

return Nil for a failed match

  • Loading branch information...
1 parent 80f798b commit 61c623e7e4ee397a0dbd6ee7deedb9d17baa370f @FROGGS FROGGS committed Feb 24, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/Cursor.pm
View
@@ -42,7 +42,7 @@ my class Cursor does NQPCursorRole {
method MATCH_SAVE() {
my $match := self.MATCH();
$last_match := $match if $match;
- $match;
+ $match || Nil
}
# INTERPOLATE will iterate over the string $tgt beginning at position 0.
@@ -79,7 +79,7 @@ my class Cursor does NQPCursorRole {
$match := nqp::substr($tgt, $pos, $eos - $pos) ~~ $topic;
# In order to return the correct result we need to match from the
# current position only.
- next if $match.from;
+ next if !$match || $match.from;
$match := ~$match;
$len := nqp::chars( $match );
}

0 comments on commit 61c623e

Please sign in to comment.