Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created May 18, 2013 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/5604090 to your computer and use it in GitHub Desktop.
Save jnthn/5604090 to your computer and use it in GitHub Desktop.
diff --git a/src/core/EnumMap.pm b/src/core/EnumMap.pm
index 4d28d09..e748ca4 100644
--- a/src/core/EnumMap.pm
+++ b/src/core/EnumMap.pm
@@ -75,10 +75,10 @@ my class EnumMap does Associative {
}
}
- method at_key($key is copy) is rw {
- $key = $key.Str;
- self.exists($key)
- ?? nqp::atkey($!storage, nqp::unbox_s($key))
+ method at_key($key) is rw {
+ my str $skey = nqp::unbox_s($key.Str);
+ nqp::defined($!storage) && nqp::existskye($!storage, $skey)
+ ?? nqp::atkey($!storage, $skey)
!! Any
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment