eolian: aliased_base_get funcs don't need unit
This commit is contained in:
parent
19c16b671e
commit
c6436337a4
|
@ -123,7 +123,7 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf,
|
||||||
else WRN("evaluation of default value failed");
|
else WRN("evaluation of default value failed");
|
||||||
}
|
}
|
||||||
/* default value or fallback */
|
/* default value or fallback */
|
||||||
const Eolian_Type *btp = eolian_type_aliased_base_get(src, tp);
|
const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
|
||||||
if (eolian_type_is_ptr(btp))
|
if (eolian_type_is_ptr(btp))
|
||||||
{
|
{
|
||||||
eina_strbuf_append(buf, "NULL");
|
eina_strbuf_append(buf, "NULL");
|
||||||
|
|
|
@ -401,8 +401,8 @@ ffi.cdef [[
|
||||||
const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
|
const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
|
||||||
const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
|
const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
||||||
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
||||||
|
@ -766,8 +766,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", {
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
aliased_base_get = function(self, unit)
|
aliased_base_get = function(self)
|
||||||
local v = eolian.eolian_typedecl_aliased_byse_get(unit, self)
|
local v = eolian.eolian_typedecl_aliased_byse_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
@ -847,8 +847,8 @@ M.Type = ffi.metatype("Eolian_Type", {
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
aliased_base_get = function(self, unit)
|
aliased_base_get = function(self)
|
||||||
local v = eolian.eolian_type_aliased_byse_get(unit, self)
|
local v = eolian.eolian_type_aliased_byse_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1807,13 +1807,12 @@ EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
|
||||||
* If the given typedecl is an alias, it returns the result of
|
* If the given typedecl is an alias, it returns the result of
|
||||||
* eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
|
* eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
|
||||||
*
|
*
|
||||||
* @param[in] unit the unit to look in
|
|
||||||
* @param[in] tp the type declaration.
|
* @param[in] tp the type declaration.
|
||||||
* @return the lowest alias base or the given type.
|
* @return the lowest alias base or the given type.
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Check if a struct or alias type declaration is extern.
|
* @brief Check if a struct or alias type declaration is extern.
|
||||||
|
@ -1973,13 +1972,12 @@ EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
|
||||||
* type actually is while still having convenience. Keep in mind that this stops
|
* type actually is while still having convenience. Keep in mind that this stops
|
||||||
* if the found type is actually a pointer (has a ptr() on it).
|
* if the found type is actually a pointer (has a ptr() on it).
|
||||||
*
|
*
|
||||||
* @param[in] unit the unit to look in
|
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the lowest alias base or the given type.
|
* @return the lowest alias base or the given type.
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
|
* @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
|
||||||
|
|
|
@ -282,22 +282,22 @@ eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Type *
|
||||||
eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp)
|
eolian_type_aliased_base_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr)
|
if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr)
|
||||||
return tp;
|
return tp;
|
||||||
const Eolian_Typedecl *btp = database_type_decl_find(unit, tp);
|
const Eolian_Typedecl *btp = eolian_type_typedecl_get(tp);
|
||||||
if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
|
if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
|
||||||
return eolian_typedecl_aliased_base_get(unit, btp);
|
return eolian_typedecl_aliased_base_get(btp);
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Type *
|
||||||
eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp)
|
eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
|
if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
|
||||||
return NULL;
|
return NULL;
|
||||||
return eolian_type_aliased_base_get(unit, tp->base_type);
|
return eolian_type_aliased_base_get(tp->base_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Class *
|
EAPI const Eolian_Class *
|
||||||
|
|
|
@ -710,8 +710,7 @@ M.Type = Node:clone {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
typedecl_get = function(self)
|
typedecl_get = function(self)
|
||||||
-- FIXME: unit
|
local v = self.type:typedecl_get()
|
||||||
local v = self.type:typedecl_get(eos:unit_get())
|
|
||||||
if not v then
|
if not v then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -719,8 +718,7 @@ M.Type = Node:clone {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
aliased_base_get = function(self)
|
aliased_base_get = function(self)
|
||||||
-- FIXME: unit
|
local v = self.type:aliased_base_get()
|
||||||
local v = self.type:aliased_base_get(eos:unit_get())
|
|
||||||
if not v then
|
if not v then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -896,8 +894,7 @@ M.Typedecl = Node:clone {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
aliased_base_get = function(self)
|
aliased_base_get = function(self)
|
||||||
-- FIXME: unit
|
local v = self.typedecl:aliased_base_get()
|
||||||
local v = self.typedecl:aliased_base_get(eos:unit_get())
|
|
||||||
if not v then
|
if not v then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1080,11 +1080,10 @@ class Type(EolianBaseObject): # OK (4 TODO Unit*)
|
||||||
c_type = lib.eolian_type_next_type_get(self._obj)
|
c_type = lib.eolian_type_next_type_get(self._obj)
|
||||||
return Type(c_type) if c_type else None
|
return Type(c_type) if c_type else None
|
||||||
|
|
||||||
# TODO FIXME STRANGE API (need Eolian_Unit*)
|
@cached_property
|
||||||
# @cached_property
|
def aliased_base(self):
|
||||||
# def aliased_base(self):
|
c_type = lib.eolian_type_aliased_base_get(self._obj)
|
||||||
# c_type = lib.eolian_type_aliased_base_get(self._obj)
|
return Type(c_type) if c_type else None
|
||||||
# return Type(c_type) if c_type else None
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def class_(self):
|
def class_(self):
|
||||||
|
@ -1172,11 +1171,10 @@ class Typedecl(EolianBaseObject): # OK (2 TODO Unit*)
|
||||||
c_type = lib.eolian_typedecl_base_type_get(self._obj)
|
c_type = lib.eolian_typedecl_base_type_get(self._obj)
|
||||||
return Type(c_type) if c_type else None
|
return Type(c_type) if c_type else None
|
||||||
|
|
||||||
# TODO FIX THIS, need Eolian_Unit* param ???
|
@cached_property
|
||||||
# @cached_property
|
def aliased_base(self):
|
||||||
# def aliased_base(self):
|
c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
|
||||||
# c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
|
return Type(c_type) if c_type else None
|
||||||
# return Type(c_type) if c_type else None
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def documentation(self):
|
def documentation(self):
|
||||||
|
|
|
@ -496,10 +496,9 @@ lib.eolian_typedecl_file_get.restype = c_char_p
|
||||||
lib.eolian_typedecl_base_type_get.argtypes = [c_void_p,]
|
lib.eolian_typedecl_base_type_get.argtypes = [c_void_p,]
|
||||||
lib.eolian_typedecl_base_type_get.restype = c_void_p
|
lib.eolian_typedecl_base_type_get.restype = c_void_p
|
||||||
|
|
||||||
# TODO FIXME STRANGE API (need Eolian_Unit*)
|
# EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
|
||||||
# EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
lib.eolian_typedecl_aliased_base_get.argtypes = [c_void_p,]
|
||||||
# lib.eolian_typedecl_aliased_base_get.argtypes = [c_void_p, c_void_p,]
|
lib.eolian_typedecl_aliased_base_get.restype = c_void_p
|
||||||
# lib.eolian_typedecl_aliased_base_get.restype = c_void_p
|
|
||||||
|
|
||||||
# EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
# EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||||
lib.eolian_typedecl_is_extern.argtypes = [c_void_p,]
|
lib.eolian_typedecl_is_extern.argtypes = [c_void_p,]
|
||||||
|
@ -554,10 +553,9 @@ lib.eolian_type_next_type_get.restype = c_void_p
|
||||||
lib.eolian_type_typedecl_get.argtypes = [c_void_p,]
|
lib.eolian_type_typedecl_get.argtypes = [c_void_p,]
|
||||||
lib.eolian_type_typedecl_get.restype = c_void_p
|
lib.eolian_type_typedecl_get.restype = c_void_p
|
||||||
|
|
||||||
# TODO FIXME STRANGE API (need Eolian_Unit*)
|
# EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
||||||
# EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
|
||||||
# lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
|
lib.eolian_type_aliased_base_get.restype = c_void_p
|
||||||
# lib.eolian_type_aliased_base_get.restype = c_void_p
|
|
||||||
|
|
||||||
# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
lib.eolian_type_class_get.argtypes = [c_void_p,]
|
lib.eolian_type_class_get.argtypes = [c_void_p,]
|
||||||
|
|
|
@ -364,7 +364,7 @@ START_TEST(eolian_typedef)
|
||||||
|
|
||||||
/* Lowest alias base */
|
/* Lowest alias base */
|
||||||
fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3")));
|
||||||
fail_if(!(type = eolian_typedecl_aliased_base_get(unit, tdl)));
|
fail_if(!(type = eolian_typedecl_aliased_base_get(tdl)));
|
||||||
fail_if(strcmp(eolian_type_name_get(type), "int"));
|
fail_if(strcmp(eolian_type_name_get(type), "int"));
|
||||||
|
|
||||||
/* Complex type */
|
/* Complex type */
|
||||||
|
|
Loading…
Reference in New Issue