forked from enlightenment/efl
eolian: support "eo: null;" for legacy only functions/properties
This commit is contained in:
parent
bbdb655bdb
commit
33c39282b1
|
@ -163,6 +163,7 @@ ffi.cdef [[
|
|||
const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
const char *eolian_function_description_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype);
|
||||
Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
|
||||
const Eolian_Function_Parameter *eolian_function_parameter_get_by_name(const Eolian_Function *function_id, const char *param_name);
|
||||
Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id);
|
||||
|
@ -516,6 +517,10 @@ M.Function = ffi.metatype("Eolian_Function", {
|
|||
return eolian.eolian_function_is_virtual_pure(self, ftype) ~= 0
|
||||
end,
|
||||
|
||||
is_legacy_only = function(self, ftype)
|
||||
return eolian.eolian_function_is_legacy_only(self, ftype) ~= 0
|
||||
end,
|
||||
|
||||
is_class = function(self)
|
||||
return eolian.eolian_function_is_class(self) ~= 0
|
||||
end,
|
||||
|
|
|
@ -662,12 +662,23 @@ EAPI Eina_Stringshare *eolian_function_description_get(const Eolian_Function *fu
|
|||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] f_type The function type, for property get/set distinction.
|
||||
* @return EINA_TRUE if virtual pure, EINA_FALSE othrewise..
|
||||
* @return EINA_TRUE if virtual pure, EINA_FALSE othrewise.
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
|
||||
/*
|
||||
* @brief Indicates if a function is legacy only.
|
||||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] f_type The function type, for property get/set distinction.
|
||||
* @return EINA_TRUE if legacy only, EINA_FALSE otherwise.
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype);
|
||||
|
||||
/*
|
||||
* @brief Get whether a function is a class method/property.
|
||||
*
|
||||
|
|
|
@ -124,12 +124,14 @@ _db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
|
|||
foo_id->set_description = eina_stringshare_ref(accessor->comment);
|
||||
if (accessor->legacy)
|
||||
foo_id->set_legacy = eina_stringshare_ref(accessor->legacy);
|
||||
foo_id->set_only_legacy = accessor->only_legacy;
|
||||
}
|
||||
else
|
||||
{
|
||||
foo_id->get_description = eina_stringshare_ref(accessor->comment);
|
||||
if (accessor->legacy)
|
||||
foo_id->get_legacy = eina_stringshare_ref(accessor->legacy);
|
||||
foo_id->get_only_legacy = accessor->only_legacy;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(accessor->params, l, acc_param)
|
||||
|
@ -251,6 +253,9 @@ _db_fill_method(Eolian_Class *cl, Eo_Class_Def *kls, Eo_Method_Def *meth)
|
|||
foo_id->obj_is_const = meth->obj_const;
|
||||
foo_id->is_class = meth->is_class;
|
||||
|
||||
if (meth->only_legacy)
|
||||
foo_id->get_only_legacy = EINA_TRUE;
|
||||
|
||||
_db_fill_params(foo_id, meth);
|
||||
|
||||
if (kls->type == EOLIAN_CLASS_INTERFACE)
|
||||
|
|
|
@ -92,6 +92,18 @@ eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
eolian_function_is_legacy_only(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_only_legacy; break;
|
||||
case EOLIAN_PROP_SET: return fid->set_only_legacy; break;
|
||||
default: return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
eolian_function_is_class(const Eolian_Function *fid)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ typedef struct _Eo_Accessor_Def
|
|||
Eina_Stringshare *comment;
|
||||
Eina_Stringshare* legacy;
|
||||
Eina_List *params; /* List of Eo_Accessor_Param */
|
||||
Eina_Bool only_legacy:1;
|
||||
} Eo_Accessor_Def;
|
||||
|
||||
/* PROPERTY */
|
||||
|
@ -78,6 +79,7 @@ typedef struct _Eo_Method_Def
|
|||
Eina_Bool obj_const;
|
||||
int scope;
|
||||
Eina_Bool is_class:1;
|
||||
Eina_Bool only_legacy:1;
|
||||
} Eo_Method_Def;
|
||||
|
||||
/* CLASS */
|
||||
|
|
|
@ -25,7 +25,7 @@ enum Tokens
|
|||
KW(virtual), \
|
||||
\
|
||||
KW(abstract), KW(constructor), KW(constructors), KW(data), \
|
||||
KW(destructor), KW(eo_prefix), KW(events), KW(func), KW(get), \
|
||||
KW(destructor), KW(eo), KW(eo_prefix), KW(events), KW(func), KW(get), \
|
||||
KW(implements), KW(interface), KW(keys), KW(legacy), KW(legacy_prefix), \
|
||||
KW(methods), KW(mixin), KW(own), KW(params), KW(properties), KW(set), \
|
||||
KW(type), KW(values), KW(var), KWAT(class), KWAT(const), \
|
||||
|
|
|
@ -1126,7 +1126,8 @@ parse_accessor(Eo_Lexer *ls)
|
|||
{
|
||||
int line, col;
|
||||
Eo_Accessor_Def *acc = NULL;
|
||||
Eina_Bool has_return = EINA_FALSE, has_legacy = EINA_FALSE;
|
||||
Eina_Bool has_return = EINA_FALSE, has_legacy = EINA_FALSE,
|
||||
has_eo = EINA_FALSE;
|
||||
acc = calloc(1, sizeof(Eo_Accessor_Def));
|
||||
acc->base.file = eina_stringshare_ref(ls->filename);
|
||||
acc->base.line = ls->line_number;
|
||||
|
@ -1156,6 +1157,14 @@ parse_accessor(Eo_Lexer *ls)
|
|||
acc->legacy = ls->tmp.legacy_def;
|
||||
ls->tmp.legacy_def = NULL;
|
||||
break;
|
||||
case KW_eo:
|
||||
CASE_LOCK(ls, eo, "eo name")
|
||||
eo_lexer_get(ls);
|
||||
check_next(ls, ':');
|
||||
check_kw_next(ls, KW_null);
|
||||
check_next(ls, ';');
|
||||
acc->only_legacy = EINA_TRUE;
|
||||
break;
|
||||
default:
|
||||
if (ls->t.token != '}')
|
||||
{
|
||||
|
@ -1280,7 +1289,7 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
|
|||
Eina_Bool has_const = EINA_FALSE, has_params = EINA_FALSE,
|
||||
has_return = EINA_FALSE, has_legacy = EINA_FALSE,
|
||||
has_protected = EINA_FALSE, has_class = EINA_FALSE,
|
||||
has_constructor = EINA_FALSE;
|
||||
has_constructor = EINA_FALSE, has_eo = EINA_FALSE;
|
||||
meth = calloc(1, sizeof(Eo_Method_Def));
|
||||
meth->base.file = eina_stringshare_ref(ls->filename);
|
||||
meth->base.line = ls->line_number;
|
||||
|
@ -1356,6 +1365,14 @@ body:
|
|||
meth->legacy = ls->tmp.legacy_def;
|
||||
ls->tmp.legacy_def = NULL;
|
||||
break;
|
||||
case KW_eo:
|
||||
CASE_LOCK(ls, eo, "eo name")
|
||||
eo_lexer_get(ls);
|
||||
check_next(ls, ':');
|
||||
check_kw_next(ls, KW_null);
|
||||
check_next(ls, ';');
|
||||
meth->only_legacy = EINA_TRUE;
|
||||
break;
|
||||
case KW_params:
|
||||
CASE_LOCK(ls, params, "params definition")
|
||||
parse_params(ls, EINA_TRUE);
|
||||
|
|
|
@ -98,6 +98,8 @@ struct _Eolian_Function
|
|||
Eina_Bool set_virtual_pure :1;
|
||||
Eina_Bool get_return_warn_unused :1; /* also used for methods */
|
||||
Eina_Bool set_return_warn_unused :1;
|
||||
Eina_Bool get_only_legacy: 1;
|
||||
Eina_Bool set_only_legacy: 1;
|
||||
Eina_Bool is_class :1;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue