Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure .perl work correctly for typed hashes

  • Loading branch information...
commit 6933c1d36d06b71666cb3b0dfb0b8a0dbe493aff 1 parent f45f221
lizmat lizmat authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/core/Hash.pm
10 src/core/Hash.pm
View
@@ -189,6 +189,11 @@ my class Hash {
nqp::unbox_s($key.Str),
bindval)
}
+ multi method perl(::?CLASS:D \SELF:) {
+ "Hash[{TValue.perl}].new("
+ ~ self.pairs.map({.perl}).join(', ')
+ ~ ')';
+ }
}
my role TypedHash[::TValue, ::TKey] does Associative[TValue] {
has $!keys;
@@ -262,6 +267,11 @@ my class Hash {
Nil
}
}
+ multi method perl(::?CLASS:D \SELF:) {
+ "Hash[{TValue.perl},{TKey.perl}].new("
+ ~ self.pairs.map({.perl}).join(', ')
+ ~ ')';
+ }
}
method PARAMETERIZE_TYPE(Mu $t, |c) {
c.elems ??
Please sign in to comment.
Something went wrong with that request. Please try again.