Skip to content
Permalink
Browse files

unival() is the same for all backends but the jvm

  • Loading branch information...
lizmat committed Jan 5, 2019
1 parent b20ff80 commit 27332f04418a027a76f16554777382731540d2ed
Showing with 6 additions and 14 deletions.
  1. +6 −14 src/core/Cool.pm6
@@ -389,16 +389,6 @@ multi sub unimatch(|) { die 'unimatch NYI on jvm backend' }
#?endif

#?if js
proto sub unival(|) {*}
multi sub unival(Str:D $str) { $str ?? unival($str.ord) !! Nil }
multi sub unival(Int:D $code) {
state $nuprop = nqp::unipropcode("Numeric_Value_Numerator");
state $deprop = nqp::unipropcode("Numeric_Value_Denominator");
my $nu = nqp::getuniprop_str($code, $nuprop);
my $de = nqp::getuniprop_str($code, $deprop);
!$de || $de eq '1' ?? $nu.Int !! $nu / $de;
}

proto sub univals(|) {*}
multi sub univals(Str:D $str) { $str.ords.map: { unival($_) } }

@@ -412,6 +402,12 @@ multi sub uniprops(|) { die 'uniprops NYI on jvm backend' }
multi sub unimatch(|) { die 'unimatch NYI on js backend' }
#?endif

#?if !jvm
proto sub unival($, *%) {*}
multi sub unival(Str:D $str) { $str ?? $str.ord.unival !! Nil }
multi sub unival(Int:D $code) { $code.unival }
#?endif

#?if moar
proto sub uniprop($, |) {*}
multi sub uniprop(Str:D $str, |c) { $str ?? uniprop($str.ord, |c) !! Nil }
@@ -547,10 +543,6 @@ multi sub uniprops(Str:D $str, Stringy:D $propname = "General_Category") {
$str.ords.map: { uniprop($_, $propname) }
}

proto sub unival($, *%) {*}
multi sub unival(Str:D $str) { $str ?? $str.ord.unival !! Nil }
multi sub unival(Int:D $code) { $code.unival }

proto sub univals($, *%) {*}
multi sub univals(Str:D $str) { $str.ords.map: { .unival } }

0 comments on commit 27332f0

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