Skip to content

Commit

Permalink
Make Junction.Str do the right thing
Browse files Browse the repository at this point in the history
Part one of more work to come
  • Loading branch information
lizmat committed Aug 9, 2017
1 parent 6745517 commit 1761f95
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/core/Junction.pm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,21 @@ my class Junction { # declared in BOOTSTRAP
}

multi method Str(Junction:D:) {
self.perl
nqp::stmts(
(my $storage := nqp::bindattr(
(my $junction := nqp::clone(self)),
Junction,
'$!storage',
nqp::clone(nqp::getattr(self,Junction,'$!storage'))
)),
(my int $elems = nqp::elems($storage)),
(my int $i = -1),
nqp::while(
nqp::islt_i(($i = nqp::add_i($i,1)),$elems),
nqp::bindpos($storage,$i,nqp::atpos($storage,$i).Str)
),
$junction
)
}

multi method gist(Junction:D:) {
Expand Down

0 comments on commit 1761f95

Please sign in to comment.