refactor objects
This commit is contained in:
@@ -14,8 +14,8 @@ func HashOf(args ...object.Object) object.Object {
|
||||
return newError(err.Error())
|
||||
}
|
||||
|
||||
if hash, ok := args[0].(object.Hashable); ok {
|
||||
return object.Integer{Value: int64(hash.HashKey().Value)}
|
||||
if hash, ok := args[0].(object.Hasher); ok {
|
||||
return object.Integer{Value: int64(hash.Hash().Value)}
|
||||
}
|
||||
|
||||
return newError("TypeError: hash() expected argument #1 to be hashable")
|
||||
|
||||
Reference in New Issue
Block a user