From: Cedric BAIL Date: Tue, 12 Feb 2019 01:39:00 +0000 (-0800) Subject: eo: return an Eina_Value error when a get for a property is not implemented. X-Git-Tag: submit/tizen/20190308.115227~146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cfe3868b30ea7e4e52d1ac68eff4b67cc8f86ad;p=platform%2Fupstream%2Fefl.git eo: return an Eina_Value error when a get for a property is not implemented. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D7936 --- diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index dbc395a..a5c72e0 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -3660,16 +3660,18 @@ efl_property_reflection_set(Eo *obj_id, const char *property_name, Eina_Value va EAPI Eina_Value efl_property_reflection_get(Eo *obj_id, const char *property_name) { - EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_VALUE_EMPTY); + Eina_Value r = eina_value_error_init(EINA_ERROR_NOT_IMPLEMENTED); + + EO_OBJ_POINTER_GOTO(obj_id, obj, end); const Efl_Object_Property_Reflection *reflection = _efl_class_reflection_find(obj->klass, property_name); - if (!reflection || !reflection->get) goto end; + if (reflection && reflection->get) + r = reflection->get(obj_id); - return reflection->get(obj_id); -end: + end: EO_OBJ_DONE(obj_id); - return EINA_VALUE_EMPTY; + return r; } EAPI Efl_Class_Type diff --git a/src/tests/eo/suite/eo_test_reflection.c b/src/tests/eo/suite/eo_test_reflection.c index b517f61..2546cfe 100644 --- a/src/tests/eo/suite/eo_test_reflection.c +++ b/src/tests/eo/suite/eo_test_reflection.c @@ -17,7 +17,7 @@ EFL_START_TEST(eo_test_reflection_invalid) simple_a_set(simple, 22); efl_property_reflection_set(simple, "simple_a_asdf", numb_val); - fail_if(efl_property_reflection_get(simple, "simple_a_invalid").type != EINA_VALUE_EMPTY.type); + fail_if(efl_property_reflection_get(simple, "simple_a_invalid").type != EINA_VALUE_TYPE_ERROR); } EFL_END_TEST