Eolian: fix type resolving for implement functions.

The type of the virtual functions implemented in a class was let unresolved
and led to inconsistency when working with them.
In fact, the type can be resolved easily after all the classes that the
specific class inherits from are parsed and stored in the database.

Fix T1228
This commit is contained in:
Daniel Zaoui 2014-05-07 09:08:30 +03:00
parent e61004e30f
commit 56fd4ef704
1 changed files with 19 additions and 3 deletions

View File

@ -1285,6 +1285,8 @@ EAPI Eina_Bool eolian_eo_file_parse(const char *filepath)
{
const Eina_List *itr;
const char *class_name = eolian_class_find_by_file(filepath);
const char *inherit_name;
Eolian_Implement impl;
if (!class_name)
{
if (!eo_tokenizer_database_fill(filepath)) return EINA_FALSE;
@ -1295,19 +1297,33 @@ EAPI Eina_Bool eolian_eo_file_parse(const char *filepath)
return EINA_FALSE;
}
}
EINA_LIST_FOREACH(eolian_class_inherits_list_get(class_name), itr, class_name)
EINA_LIST_FOREACH(eolian_class_inherits_list_get(class_name), itr, inherit_name)
{
char *filename = strdup(class_name);
char *filename = strdup(inherit_name);
eina_str_tolower(&filename);
filepath = eina_hash_find(_filenames, filename);
if (!filepath)
{
ERR("Unable to find class %s", class_name);
ERR("Unable to find class %s", inherit_name);
return EINA_FALSE;
}
if (!eolian_eo_file_parse(filepath)) return EINA_FALSE;
free(filename);
}
EINA_LIST_FOREACH(eolian_class_implements_list_get(class_name), itr, impl)
{
_Implement_Desc *_impl = (_Implement_Desc *)impl;
Eolian_Function foo = eolian_class_function_find_by_name(_impl->class_name, _impl->func_name, _impl->type);
if (!foo)
{
ERR("Unable to find function %s in class %s", _impl->func_name, _impl->class_name);
return EINA_FALSE;
}
if (_impl->type == EOLIAN_UNRESOLVED)
{
_impl->type = eolian_function_type_get(foo);
}
}
return EINA_TRUE;
}