added hash,copy methods for lists and maps. The hash method is now obligatory

This commit is contained in:
cozis
2022-03-09 13:05:05 +01:00
parent 0e9075bdbc
commit 7412f91d7d
6 changed files with 110 additions and 24 deletions
+2 -9
View File
@@ -64,19 +64,12 @@ unsigned int Object_GetDeepSize(const Object *obj, Error *err)
return type->deepsize(obj);
}
int Object_Hash(Object *obj, Error *err)
int Object_Hash(Object *obj)
{
assert(obj != NULL);
const TypeObject *type = Object_GetType(obj);
assert(type != NULL);
if(type->hash == NULL)
{
Error_Report(err, 0, "Object %s doesn't implement %s", Object_GetName(obj), __func__);
return -1;
}
assert(type->hash != NULL);
return type->hash(obj);
}