Skip to content
Permalink
Browse files

Better fix for GH#1020

Let the empty string only suffer from having an iterator created that
doesn't do anything, instead of *all* strings suffering from an extra check.
  • Loading branch information...
lizmat committed Jul 2, 2018
1 parent f8d6a3f commit 72ccd432a7155e408791da6cafd3b4c408661c04
Showing with 1 addition and 7 deletions.
  1. +1 −7 src/core/Str.pm6
@@ -350,13 +350,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
self
)
}
method new(\string) {
nqp::if(
string.chars, # GH#1020
nqp::create(self)!SET-SELF(string),
Rakudo::Iterator.Empty
)
}
method new(\string) { nqp::create(self)!SET-SELF(string) }
method pull-one() {
nqp::if(
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),$!chars),

1 comment on commit 72ccd43

@lizmat

This comment has been minimized.

Copy link
Contributor Author

commented on 72ccd43 Jul 2, 2018

Oops, this should have referenced GH#2010

Please sign in to comment.
You can’t perform that action at this time.