Skip to content

Commit

Permalink
Hash.of/name/default/dynamic can only be called on instances
Browse files Browse the repository at this point in the history
And since a Hash nowadays *always* has a descriptor, we can remove the
check for that.
  • Loading branch information
lizmat committed Oct 8, 2018
1 parent 9acbf00 commit 39086fe
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/core/Hash.pm6
Expand Up @@ -213,21 +213,12 @@ my class Hash { # declared in BOOTSTRAP
}

# introspection
method name() {
nqp::isnull($!descriptor) ?? Nil !! $!descriptor.name
}
method keyof() {
Str(Any)
}
method of() {
nqp::isnull($!descriptor) ?? Mu !! $!descriptor.of
}
method default() {
nqp::isnull($!descriptor) ?? Any !! $!descriptor.default
}
method dynamic() {
nqp::isnull($!descriptor) ?? False !! nqp::hllbool($!descriptor.dynamic)
}
method keyof() { Str(Any) } # overridden by TypedHash

method of(Hash:D:) { $!descriptor.of }
method name(Hash:D:) { $!descriptor.name }
method default(Hash:D:) { $!descriptor.default }
method dynamic(Hash:D:) { nqp::hllbool($!descriptor.dynamic) }

method push(+values) {
fail X::Cannot::Lazy.new(:action<push>, :what(self.^name))
Expand Down

0 comments on commit 39086fe

Please sign in to comment.