Skip to content

Commit

Permalink
Make Set.WHICH return a ValueObjAt
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Dec 28, 2018
1 parent 4b91610 commit 537621e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/core/Set.pm6
@@ -1,19 +1,25 @@
my class Set does Setty {
has $!WHICH;
has ValueObjAt $!WHICH;

multi method WHICH (Set:D:) {
multi method WHICH (Set:D: --> ValueObjAt:D) {
nqp::if(
nqp::attrinited(self,Set,'$!WHICH'),
$!WHICH,
$!WHICH := nqp::if(
nqp::istype(self.WHAT,Set),
'Set|',
nqp::concat(self.^name,'|')
) ~ nqp::sha1(
$!WHICH := nqp::box_s(
nqp::concat(
nqp::if(
nqp::eqaddr(self.WHAT,Set),
'Set|',
nqp::concat(nqp::unbox_s(self.^name), '|')
),
nqp::sha1(
nqp::join("\0",Rakudo::Sorting.MERGESORT-str(
Rakudo::QuantHash.RAW-KEYS(self)
))
)
)
),
ValueObjAt
)
)
}

Expand Down

0 comments on commit 537621e

Please sign in to comment.