Skip to content

Commit

Permalink
Hopefully fully unbreak JVM backend
Browse files Browse the repository at this point in the history
usev6++ for guidance
  • Loading branch information
lizmat committed Apr 3, 2021
1 parent 496f986 commit b88e1ca
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/core.c/unicodey.pm6
Expand Up @@ -7,13 +7,13 @@ my class Rakudo::Unicodey is implementation-detail {
}

method ords(str $str) { # strtocodes NYI on JVM
my int @ords;
my @ords;
my int $chars = nqp::chars($str);
my int $i = -1;

nqp::while(
nqp::islt_i(($i = nqp::add_i($i,1)),$chars),
nqp::push_i(@ords,nqp::ord($str,$i))
nqp::push(@ords,nqp::ord($str,$i))
);

@ords
Expand Down Expand Up @@ -95,14 +95,24 @@ my class Rakudo::Unicodey is implementation-detail {
my class UninamesIterator does UnicodeyIterator {
method pull-one() {
nqp::elems($!codes)
#?if jvm
?? nqp::getuniname(nqp::shift($!codes))
#?endif
#?if !jvm
?? nqp::getuniname(nqp::shift_i($!codes))
#?endif
!! IterationEnd
}
method push-all(\target --> IterationEnd) {
my $codes := $!codes;
nqp::while(
nqp::elems($codes),
#?if jvm
target.push(nqp::getuniname(nqp::shift($codes)))
#?endif
#?if !jvm
target.push(nqp::getuniname(nqp::shift_i($codes)))
#?endif
);
}
}
Expand All @@ -111,14 +121,24 @@ my class Rakudo::Unicodey is implementation-detail {
my class UnivalsIterator does UnicodeyIterator {
method pull-one() {
nqp::elems($!codes)
#?if jvm
?? Rakudo::Unicodey.unival(nqp::shift($!codes))
#?endif
#?if !jvm
?? Rakudo::Unicodey.unival(nqp::shift_i($!codes))
#?endif
!! IterationEnd
}
method push-all(\target --> IterationEnd) {
my $codes := $!codes;
nqp::while(
nqp::elems($codes),
#?if jvm
target.push(Rakudo::Unicodey.unival(nqp::shift($codes)))
#?endif
#?if !jvm
target.push(Rakudo::Unicodey.unival(nqp::shift_i($codes)))
#?endif
);
}
}
Expand Down

0 comments on commit b88e1ca

Please sign in to comment.