Skip to content

Commit

Permalink
Supply.split should only produce Str
Browse files Browse the repository at this point in the history
The underlying Match objects only have meaning for the chunk that they
were created in.  There's no meaningful information that can be gathered
from them outside of that context.
  • Loading branch information
lizmat committed Jan 16, 2020
1 parent 550bf09 commit 2188f13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core.c/Supply-factories.pm6
Expand Up @@ -641,13 +641,13 @@
# split the supply on the needle and adverbs
multi method split(Supply:D: \needle) {
supply {
my $str = ""; # can also be a Match object
my $str = ""; # prevent warning on first batch
my @matches;
whenever self -> \value {
done unless @matches = ($str ~ value).split(needle, |%_);
$str = @matches.pop; # keep last for next batch
$str = @matches.pop.Str; # keep last for next batch

emit $_ for @matches;
emit .Str for @matches;

LAST { emit $str }
}
Expand Down

0 comments on commit 2188f13

Please sign in to comment.