Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix .perl on uncontained typed hashes
  • Loading branch information
lizmat committed May 28, 2015
1 parent 802983e commit 478994f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/core/Hash.pm
Expand Up @@ -385,17 +385,15 @@ my class Hash { # declared in BOOTSTRAP
HashIter.invert(self,$!keys).list
}
multi method perl(::?CLASS:D \SELF:) {
if nqp::iscont(SELF) and TKey === Any and TValue === Mu {
my $TKey-perl := TKey.perl;
my $TValue-perl := TValue.perl;
if nqp::iscont(SELF) && $TKey-perl eq 'Any' && $TValue-perl eq 'Mu' {
':{' ~ SELF.pairs.sort.map({.perl}).join(', ') ~ '}'
}
else {
'Hash['
~ TValue.perl
~ ','
~ TKey.perl
~ '].new('
~ self.pairs.sort.map({.perl(:arglist)}).join(', ')
~ ')';
"Hash[$TValue-perl,$TKey-perl].new({
self.pairs.sort.map({.perl(:arglist)}).join(', ')
})";
}
}
multi method DELETE-KEY($key) {
Expand Down

0 comments on commit 478994f

Please sign in to comment.