Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
handle non-Str case of EnuMap.exists
  • Loading branch information
moritz committed Aug 8, 2011
1 parent 3ea71cf commit 169baab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/EnumMap.pm
Expand Up @@ -17,12 +17,19 @@ my class EnumMap does Associative {
so self.exists($topic);
}

method exists(EnumMap:D: Str \$key) {
proto method exists(|$) {*}
multi method exists(EnumMap:D: Str:D \$key) {
nqp::p6bool(
pir::defined($!storage)
&& nqp::existskey($!storage, nqp::unbox_s($key))
)
}
multi method exists(EnumMap:D: \$key) {
nqp::p6bool(
pir::defined($!storage)
&& nqp::existskey($!storage, nqp::unbox_s($key.Stringy))
)
}

method iterator() { self.pairs.iterator }
method list() { self.pairs }
Expand Down

0 comments on commit 169baab

Please sign in to comment.