Skip to content

Commit

Permalink
Move ords() logic to Str.ords
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 2, 2018
1 parent 1894eac commit 6117647
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/core/Cool.pm
Expand Up @@ -121,7 +121,8 @@ my class Cool { # declared in BOOTSTRAP
proto method chrs(|) {*}
multi method chrs(Cool:D:) { self.list.chrs }

method ords(Cool:D:) { self.Str.ords }
proto method ords(|) {*}
multi method ords(Cool:D:) { self.Str.ords }

method flip() {
self.Str.flip
Expand Down Expand Up @@ -319,7 +320,7 @@ proto sub indices(|) {*}
multi sub indices(Cool $s, |c) { $s.indices(|c) }

proto sub ords($) {*}
multi sub ords(Cool $s) { ords($s.Stringy) }
multi sub ords(Cool:D $s) { $s.ords }

proto sub comb($, $, $?) {*}
multi sub comb(Regex $matcher, Cool $input, $limit = *) { $input.comb($matcher, $limit) }
Expand Down
8 changes: 2 additions & 6 deletions src/core/Str.pm
Expand Up @@ -1254,10 +1254,10 @@ my class Str does Stringy { # declared in BOOTSTRAP
}

#?if moar
method ords(Str:D:) { self.NFC.list }
multi method ords(Str:D:) { self.NFC.list }
#?endif
#?if !moar
method ords(Str:D:) {
multi method ords(Str:D:) {
Seq.new(class :: does Iterator {
has str $!str;
has int $!chars;
Expand Down Expand Up @@ -3035,10 +3035,6 @@ multi sub infix:«~<»(str $a, int $b) {
X::NYI.new(feature => "infix:«~<»").throw;
}

multi sub ords(Str $s) {
$s.ords
}

proto sub trim(|) {*}
multi sub trim(Cool:D $s --> Str:D) { $s.trim }

Expand Down

0 comments on commit 6117647

Please sign in to comment.