Skip to content

Commit

Permalink
Make a string copy of ~self to work with in Cool.comb, so that repeat…
Browse files Browse the repository at this point in the history
…ed calls to .match do not do ~self internally each time.
  • Loading branch information
colomon committed Jan 14, 2011
1 parent 89ff888 commit 9f6a678
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/Cool-str.pm
Expand Up @@ -55,9 +55,10 @@ augment class Cool {
}

multi method comb(Regex $matcher = /./, $limit = *, :$match) {
my $self-string = ~self;
my $c = 0;
my $l = $limit ~~ ::Whatever ?? Inf !! $limit;
gather while $l > 0 && (my $m = self.match($matcher, :c($c))) {
gather while $l > 0 && (my $m = $self-string.match($matcher, :c($c))) {
if $match {
my $m-clone = $m;
take $m-clone;
Expand Down

0 comments on commit 9f6a678

Please sign in to comment.