eolian: add eolian_function_is_c_only

This function allows us to mark functions that are not bindable.
Also remove some obsolete code.
This commit is contained in:
Daniel Kolesa 2014-12-03 14:59:24 +00:00
parent ecfcb59c44
commit 49aebd063e
5 changed files with 54 additions and 45 deletions

View File

@ -873,6 +873,16 @@ EAPI Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id
*/
EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
/*
* @brief Get whether a function is C only (i.e. not bindable).
*
* @param[in] function_id Id of the function
* @return EINA_TRUE and EINA_FALSE respectively
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_function_is_c_only(const Eolian_Function *function_id);
/*
* @brief Indicates if a function is a constructing function of a given class.
*

View File

@ -249,3 +249,10 @@ eolian_function_object_is_const(const Eolian_Function *fid)
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
return fid->obj_is_const;
}
EAPI Eina_Bool
eolian_function_is_c_only(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
return fid->is_c_only;
}

View File

@ -29,8 +29,8 @@ enum Tokens
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(auto), \
KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), KWAT(empty), \
KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), \
KWAT(c_only), KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), \
KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), \
KWAT(optional), KWAT(out), KWAT(private), KWAT(protected), KWAT(virtual), \
KWAT(warn_unused), \
\

View File

@ -1276,7 +1276,8 @@ parse_property(Eo_Lexer *ls)
Eolian_Function *prop = NULL;
Eina_Bool has_get = EINA_FALSE, has_set = EINA_FALSE,
has_keys = EINA_FALSE, has_values = EINA_FALSE,
has_protected = EINA_FALSE, has_class = EINA_FALSE;
has_protected = EINA_FALSE, has_class = EINA_FALSE,
has_c_only = EINA_FALSE;
prop = calloc(1, sizeof(Eolian_Function));
prop->klass = ls->tmp.kls;
prop->type = EOLIAN_UNRESOLVED;
@ -1299,6 +1300,11 @@ parse_property(Eo_Lexer *ls)
prop->is_class = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_c_only:
CASE_LOCK(ls, c_only, "c_only qualifier");
prop->is_c_only = EINA_TRUE;
eo_lexer_get(ls);
break;
default:
goto body;
}
@ -1340,14 +1346,14 @@ end:
}
static void
parse_method(Eo_Lexer *ls, Eina_Bool ctor)
parse_method(Eo_Lexer *ls)
{
int line, col;
Eolian_Function *meth = NULL;
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_eo = EINA_FALSE;
has_eo = EINA_FALSE, has_c_only = EINA_FALSE;
meth = calloc(1, sizeof(Eolian_Function));
meth->klass = ls->tmp.kls;
meth->type = EOLIAN_METHOD;
@ -1355,48 +1361,33 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
meth->base.line = ls->line_number;
meth->base.column = ls->column;
ls->tmp.kls->methods = eina_list_append(ls->tmp.kls->methods, meth);
if (ctor)
check(ls, TOK_VALUE);
meth->name = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
for (;;) switch (ls->t.kw)
{
if (ls->t.token != TOK_VALUE)
eo_lexer_syntax_error(ls, "expected method name");
meth->name = eina_stringshare_ref(ls->t.value.s);
case KW_at_protected:
CASE_LOCK(ls, protected, "protected qualifier")
meth->scope = EOLIAN_SCOPE_PROTECTED;
eo_lexer_get(ls);
for (;;) switch (ls->t.kw)
{
case KW_at_protected:
CASE_LOCK(ls, protected, "protected qualifier")
meth->scope = EOLIAN_SCOPE_PROTECTED;
eo_lexer_get(ls);
break;
default:
goto body;
}
}
else
{
check(ls, TOK_VALUE);
meth->name = eina_stringshare_ref(ls->t.value.s);
break;
case KW_at_const:
CASE_LOCK(ls, const, "const qualifier")
meth->obj_is_const = EINA_TRUE;
eo_lexer_get(ls);
for (;;) switch (ls->t.kw)
{
case KW_at_protected:
CASE_LOCK(ls, protected, "protected qualifier")
meth->scope = EOLIAN_SCOPE_PROTECTED;
eo_lexer_get(ls);
break;
case KW_at_const:
CASE_LOCK(ls, const, "const qualifier")
meth->obj_is_const = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_class:
CASE_LOCK(ls, class, "class qualifier");
meth->is_class = EINA_TRUE;
eo_lexer_get(ls);
break;
default:
goto body;
}
break;
case KW_at_class:
CASE_LOCK(ls, class, "class qualifier");
meth->is_class = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_c_only:
CASE_LOCK(ls, c_only, "c_only qualifier");
meth->is_c_only = EINA_TRUE;
eo_lexer_get(ls);
break;
default:
goto body;
}
body:
line = ls->line_number;
@ -1671,7 +1662,7 @@ parse_methods(Eo_Lexer *ls)
line = ls->line_number, col = ls->column;
check_next(ls, '{');
while (ls->t.token != '}')
parse_method(ls, EINA_FALSE);
parse_method(ls);
check_match(ls, '}', '{', line, col);
}

View File

@ -118,6 +118,7 @@ struct _Eolian_Function
Eina_Bool get_only_legacy: 1;
Eina_Bool set_only_legacy: 1;
Eina_Bool is_class :1;
Eina_Bool is_c_only :1;
Eina_List *ctor_of;
Eolian_Class *klass;
};