Obj* Err_downcast(Obj *obj, VTable *vtable, const char *file, int line, const char *func) { if (obj && !SI_obj_is_a(obj, vtable)) { Err_throw_at(ERR, file, line, func, "Can't downcast from %o to %o", Obj_Get_Class_Name(obj), VTable_Get_Name(vtable)); } return obj; }
Obj* Err_downcast(Obj *obj, Class *klass, const char *file, int line, const char *func) { if (obj && !SI_obj_is_a(obj, klass)) { Err_throw_at(ERR, file, line, func, "Can't downcast from %o to %o", Obj_get_class_name(obj), Class_Get_Name(klass)); } return obj; }
Obj* Err_certify(Obj *obj, VTable *vtable, const char *file, int line, const char *func) { if (!obj) { Err_throw_at(ERR, file, line, func, "Object isn't a %o, it's NULL", VTable_Get_Name(vtable)); } else if (!SI_obj_is_a(obj, vtable)) { Err_throw_at(ERR, file, line, func, "Can't downcast from %o to %o", Obj_Get_Class_Name(obj), VTable_Get_Name(vtable)); } return obj; }
Obj* Err_certify(Obj *obj, Class *klass, const char *file, int line, const char *func) { if (!obj) { Err_throw_at(ERR, file, line, func, "Object isn't a %o, it's NULL", Class_Get_Name(klass)); } else if (!SI_obj_is_a(obj, klass)) { Err_throw_at(ERR, file, line, func, "Can't downcast from %o to %o", Obj_get_class_name(obj), Class_Get_Name(klass)); } return obj; }