Skip to content

Commit

Permalink
Make sure that Cool.substr-eq passes on :i, :m
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Feb 14, 2020
1 parent 5a716a3 commit 7cb0481
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/core.c/Cool.pm6
Expand Up @@ -185,17 +185,29 @@ my class Cool { # declared in BOOTSTRAP
}

proto method substr-eq(|) {*}
multi method substr-eq(Cool:D:
Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark) --> Bool:D) {
self.Str.starts-with($needle.Str, :$ignorecase, :$ignoremark)
}
multi method substr-eq(Cool:D:
Cool:D $needle, :m(:$ignoremark) --> Bool:D) {
self.Str.starts-with($needle.Str, :$ignoremark)
}
multi method substr-eq(Cool:D: Cool:D $needle --> Bool:D) {
nqp::hllbool(nqp::eqat(self.Str,$needle.Str,0))
self.Str.starts-with($needle.Str)
}
multi method substr-eq(Cool:D: Str:D $needle --> Bool:D) {
nqp::hllbool(nqp::eqat(self.Str,$needle,0))

multi method substr-eq(Cool:D:
Cool:D $needle, Cool:D $pos, :i(:$ignorecase)!, :m(:$ignoremark)
--> Bool:D) {
self.Str.substr-eq($needle.Str, $pos.Int, :$ignorecase, :$ignoremark)
}
multi method substr-eq(Cool:D: Cool:D $needle, Int:D $pos --> Bool:D) {
self.Str.substr-eq($needle.Str, $pos)
multi method substr-eq(Cool:D:
Cool:D $needle, Cool:D $pos, :m(:$ignoremark)! --> Bool:D) {
self.Str.substr-eq($needle.Str, $pos.Int, :$ignoremark)
}
multi method substr-eq(Cool:D: Str:D $needle, Int:D $pos --> Bool:D) {
self.Str.substr-eq($needle, $pos)
multi method substr-eq(Cool:D: Cool:D $needle, Cool:D $pos --> Bool:D) {
self.Str.substr-eq($needle.Str, $pos.Int)
}

method !list-as-string($suggestion) is hidden-from-backtrace {
Expand Down

0 comments on commit 7cb0481

Please sign in to comment.