From 289287f497df2d521dc5e1c66e31c83ceeed3a47 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 11 Jan 2017 18:18:48 +0100 Subject: [PATCH] eolian: remove function_is_implemented Its design does not match current Eolian and will be replaced later. There isn't any generator using it right now, so it's safe to remove. --- src/lib/eolian/Eolian.h | 13 ------- src/lib/eolian/database_function_api.c | 63 ---------------------------------- src/tests/eolian/eolian_parsing.c | 12 ------- 3 files changed, 88 deletions(-) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 4275e90..820bcb5 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -1022,19 +1022,6 @@ EAPI Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_i EAPI const Eolian_Class *eolian_function_class_get(const Eolian_Function *function_id); /* - * @brief Determine if a function is implemented in the inheritance of the given class - * - * @param[in] function_id id of the function - * @param[in] func_type type requested - * @param[in] klass the top class to begin with - * @return EINA_TRUE if found, EINA_FALSE otherwise - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_function_is_implemented(const Eolian_Function *function_id, - Eolian_Function_Type func_type, const Eolian_Class *klass); - -/* * @brief Get full string of an overriding function (implement). * * @param[in] impl the handle of the implement diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c index 7ae544b..fd12325 100644 --- a/src/lib/eolian/database_function_api.c +++ b/src/lib/eolian/database_function_api.c @@ -358,66 +358,3 @@ eolian_function_is_beta(const Eolian_Function *fid) EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); return fid->is_beta; } - -EAPI Eina_Bool eolian_function_is_implemented( - const Eolian_Function *function_id, Eolian_Function_Type func_type, - const Eolian_Class *klass) -{ - Eina_Iterator *impl_itr = NULL; - Eolian_Function_Type found_type = EOLIAN_UNRESOLVED; - Eina_Bool found = EINA_TRUE; - if (!function_id || !klass) return EINA_FALSE; - Eina_List *list = eina_list_append(NULL, klass), *list2, *itr; - EINA_LIST_FOREACH(list, itr, klass) - { - const char *inherit_name; - const Eolian_Implement *impl; - if (eolian_class_type_get(klass) == EOLIAN_CLASS_INTERFACE) continue; - impl_itr = eolian_class_implements_get(klass); - EINA_ITERATOR_FOREACH(impl_itr, impl) - { - if (eolian_implement_is_virtual(impl)) continue; - Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED; - const Eolian_Function *impl_func = eolian_implement_function_get(impl, &impl_type); - if (impl_func == function_id) - { - /* The type matches the requested or is not important for the caller */ - if (func_type == EOLIAN_UNRESOLVED || impl_type == func_type) goto end; - if (impl_type == EOLIAN_METHOD) continue; - /* In case we search for a property type */ - if (impl_type == EOLIAN_PROPERTY && - (func_type == EOLIAN_PROP_GET || func_type == EOLIAN_PROP_SET)) - goto end; - /* Property may be splitted on multiple implements */ - if (func_type == EOLIAN_PROPERTY) - { - if (found_type == EOLIAN_UNRESOLVED) found_type = impl_type; - if ((found_type == EOLIAN_PROP_SET && impl_type == EOLIAN_PROP_GET) || - (found_type == EOLIAN_PROP_GET && impl_type == EOLIAN_PROP_SET)) - goto end; - } - } - } - eina_iterator_free(impl_itr); - impl_itr = NULL; - - Eina_Iterator *inherits_itr = eolian_class_inherits_get(klass); - EINA_ITERATOR_FOREACH(inherits_itr, inherit_name) - { - const Eolian_Class *inherit = eolian_class_get_by_name(inherit_name); - /* Avoid duplicates. */ - if (!eina_list_data_find(list, inherit)) - { - list2 = eina_list_append(list, inherit); - } - } - eina_iterator_free(inherits_itr); - } - (void) list2; - found = EINA_FALSE; -end: - if (impl_itr) eina_iterator_free(impl_itr); - eina_list_free(list); - return found; -} - diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index b7146ae..7185ab2 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -188,27 +188,15 @@ START_TEST(eolian_override) /* Base ctor */ fail_if(!(fid = eolian_class_function_get_by_name(base, "constructor", EOLIAN_UNRESOLVED))); fail_if(!eolian_function_is_virtual_pure(fid, EOLIAN_UNRESOLVED)); - fail_if(!eolian_function_is_implemented(fid, EOLIAN_UNRESOLVED, class)); - fail_if(!eolian_function_is_implemented(fid, EOLIAN_METHOD, class)); - fail_if(eolian_function_is_implemented(fid, EOLIAN_PROP_GET, class)); /* Property */ fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY))); fail_if(!eolian_function_is_virtual_pure(fid, EOLIAN_PROP_SET)); fail_if(eolian_function_is_virtual_pure(fid, EOLIAN_PROP_GET)); - fail_if(eolian_function_is_implemented(fid, EOLIAN_PROP_SET, class)); - fail_if(!eolian_function_is_implemented(fid, EOLIAN_PROP_GET, class)); - fail_if(eolian_function_is_implemented(fid, EOLIAN_PROPERTY, class)); /* Method */ fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); fail_if(!eolian_function_is_virtual_pure(fid, EOLIAN_METHOD)); - fail_if(eolian_function_is_implemented(fid, EOLIAN_UNRESOLVED, class)); - fail_if(eolian_function_is_implemented(fid, EOLIAN_UNRESOLVED, base)); - - fail_if(!(fid = eolian_class_function_get_by_name(base, "z", EOLIAN_PROPERTY))); - fail_if(!eolian_function_is_implemented(fid, EOLIAN_PROPERTY, class)); - fail_if(!eolian_function_is_implemented(fid, EOLIAN_PROP_SET, class)); /* Implements */ fail_if(!(iter = eolian_class_implements_get(class))); -- 2.7.4