Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure .perl work correctly for typed hashes
  • Loading branch information
lizmat committed Jul 8, 2013
1 parent f45f221 commit 6933c1d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/Hash.pm
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ??
Expand Down

0 comments on commit 6933c1d

Please sign in to comment.