eolian: use unit in typedecl c_type_get

This commit is contained in:
Daniel Kolesa 2017-05-26 15:09:49 +02:00
parent d4c835545b
commit d2280f91a1
5 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp,
{
case EOLIAN_TYPEDECL_ALIAS:
{
Eina_Stringshare *tn = eolian_typedecl_c_type_get(tp);
Eina_Stringshare *tn = eolian_typedecl_c_type_get(src, tp);
eina_strbuf_append(buf, tn);
eina_stringshare_del(tn);
break;

View File

@ -342,7 +342,7 @@ ffi.cdef [[
Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
const char *eolian_type_c_type_get(const Eolian_Type *tp);
const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
const char *eolian_type_name_get(const Eolian_Type *tp);
const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp);
@ -624,8 +624,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", {
return eolian.eolian_typedecl_is_extern(self) ~= 0
end,
c_type_get = function(self)
local v = eolian.eolian_typedecl_c_type_get(self)
c_type_get = function(self, unit)
local v = eolian.eolian_typedecl_c_type_get(unit, self)
if v == nil then return nil end
return ffi_stringshare(v)
end,

View File

@ -1677,6 +1677,7 @@ EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
/*
* @brief Get the full C type name of the given type.
*
* @param[in] unit the unit to look in
* @param[in] tp the type declaration.
* @return The C type name assuming @c tp is not NULL.
*
@ -1686,7 +1687,7 @@ EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
/*
* @brief Get the name of the given type declaration. Keep in mind that the

View File

@ -368,14 +368,13 @@ eolian_type_c_type_get(const Eolian_Type *tp)
}
EAPI Eina_Stringshare *
eolian_typedecl_c_type_get(const Eolian_Typedecl *tp)
eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp)
{
Eina_Stringshare *ret;
Eina_Strbuf *buf;
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
buf = eina_strbuf_new();
/* FIXME: pass unit properly */
database_typedecl_to_str(NULL, tp, buf);
database_typedecl_to_str(unit, tp, buf);
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
return ret;

View File

@ -333,7 +333,7 @@ START_TEST(eolian_typedef)
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS);
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
fail_if(strcmp(type_name, "Coord"));
fail_if(!(type_name = eolian_typedecl_c_type_get(tdl)));
fail_if(!(type_name = eolian_typedecl_c_type_get(unit, tdl)));
fail_if(strcmp(type_name, "typedef int Evas_Coord"));
eina_stringshare_del(type_name);
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));