Skip to content

Commit

Permalink
Clone the returned match so we can take it without worrying about the…
Browse files Browse the repository at this point in the history
… next iteration clobbering it.
  • Loading branch information
colomon committed Apr 28, 2010
1 parent 6a502fc commit 72f914f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/Cool-str.pm
Expand Up @@ -72,7 +72,8 @@ augment class Cool {
gather {
while $l-- > 0 && (my $m = self.match($matcher, :c($c))) {
take self.substr($c, $m.from - $c);
take $m if $all;
my $m-clone = $m;
take $m-clone if $all;
$c = $m.to == $c ?? $c + 1 !! $m.to;
}
take self.substr($c);
Expand Down

0 comments on commit 72f914f

Please sign in to comment.