Skip to content

Commit

Permalink
Privatize Quanthash hashification
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jun 10, 2018
1 parent 0ac5c4f commit 09a9bbc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/core/Baggy.pm6
Expand Up @@ -262,7 +262,7 @@ my role Baggy does QuantHash {
nqp::p6bool($!elems && nqp::elems($!elems))
}

method HASHIFY(\type) {
method !HASHIFY(\type) {
nqp::stmts(
(my $hash := Hash.^parameterize(type,Any).new),
(my $descriptor := nqp::getattr($hash,Hash,'$!descriptor')),
Expand Down Expand Up @@ -291,8 +291,8 @@ my role Baggy does QuantHash {
$hash
)
}
multi method hash(Baggy:D: --> Hash:D) { self.HASHIFY(Any) }
multi method Hash(Baggy:D: --> Hash:D) { self.HASHIFY(UInt) }
multi method hash(Baggy:D: --> Hash:D) { self!HASHIFY(Any) }
multi method Hash(Baggy:D: --> Hash:D) { self!HASHIFY(UInt) }

method default(Baggy:D: --> 0) { }

Expand Down
4 changes: 2 additions & 2 deletions src/core/Mixy.pm6
@@ -1,7 +1,7 @@
my role Mixy does Baggy {

multi method hash(Mixy:D: --> Hash:D) { self.HASHIFY(Any) }
multi method Hash(Mixy:D: --> Hash:D) { self.HASHIFY(Real) }
multi method hash(Mixy:D: --> Hash:D) { self!HASHIFY(Any) }
multi method Hash(Mixy:D: --> Hash:D) { self!HASHIFY(Real) }

multi method kxxv(Mixy:D:) {
Failure.new(".kxxv is not supported on a {self.^name}")
Expand Down
6 changes: 3 additions & 3 deletions src/core/Setty.pm6
Expand Up @@ -74,7 +74,7 @@ my role Setty does QuantHash {
nqp::p6bool($!elems && nqp::elems($!elems))
}

method HASHIFY(\type) {
method !HASHIFY(\type) {
nqp::stmts(
(my $hash := Hash.^parameterize(type,Any).new),
(my $descriptor := nqp::getattr($hash,Hash,'$!descriptor')),
Expand All @@ -100,8 +100,8 @@ my role Setty does QuantHash {
$hash
)
}
multi method hash(Setty:D: --> Hash:D) { self.HASHIFY(Any) }
multi method Hash(Setty:D: --> Hash:D) { self.HASHIFY(Bool) }
multi method hash(Setty:D: --> Hash:D) { self!HASHIFY(Any) }
multi method Hash(Setty:D: --> Hash:D) { self!HASHIFY(Bool) }

multi method ACCEPTS(Setty:U: \other) { other.^does(self) }
multi method ACCEPTS(Setty:D: Setty:D \other) {
Expand Down

0 comments on commit 09a9bbc

Please sign in to comment.