Skip to content

Commit

Permalink
Revert partial work on concatting Junctions for release
Browse files Browse the repository at this point in the history
To be reinstated after 2017.08 and completed then.
  • Loading branch information
lizmat committed Aug 19, 2017
1 parent e3e29c5 commit afa8fc1
Showing 1 changed file with 1 addition and 80 deletions.
81 changes: 1 addition & 80 deletions src/core/Junction.pm
Expand Up @@ -198,24 +198,7 @@ my class Junction { # declared in BOOTSTRAP
}

multi method Str(Junction:D:) {
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::unless(
nqp::istype(nqp::atpos($storage,$i),Str),
nqp::bindpos($storage,$i,nqp::atpos($storage,$i).Str)
)
),
$junction
)
self.perl
}

multi method gist(Junction:D:) {
Expand Down Expand Up @@ -329,68 +312,6 @@ sub infix:<|>(+values) is pure { values.any }
sub infix:<&>(+values) is pure { values.all }
sub infix:<^>(+values) is pure { values.one }

multi sub infix:<~>(Str:D $a, Junction:D $b) {
nqp::if(
$a,
nqp::stmts( # something to concat with
(my $storage := nqp::bindattr(
(my $junction := nqp::clone($b)),
Junction,
'$!storage',
nqp::clone(nqp::getattr($b,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::concat(
$a,
nqp::if(
nqp::istype((my $val := nqp::atpos($storage,$i)),Str),
$val,
$val.Str
)
)
)
),
$junction
),
$b.Str # nothing to concat with
)
}

multi sub infix:<~>(Junction:D $a, Str:D $b) {
nqp::if(
$b,
nqp::stmts( # something to concat with
(my $storage := nqp::bindattr(
(my $junction := nqp::clone($a)),
Junction,
'$!storage',
nqp::clone(nqp::getattr($a,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::concat(
nqp::if(
nqp::istype((my $val := nqp::atpos($storage,$i)),Str),
$val,
$val.Str
),
$b
)
)
),
$junction
),
$a.Str # nothing to concat with
)
}

sub AUTOTHREAD(|c) {
Junction.AUTOTHREAD(|c)
}
Expand Down

0 comments on commit afa8fc1

Please sign in to comment.