forked from enlightenment/efl
eolian: add @cref as alternative to @in
This is a "pass by reference to const" equivalent. There is no explicit pointer and currently it's the same as ptr(const(x)) on the type. However, it is also usable on properties.
This commit is contained in:
parent
0496b7988a
commit
eab6f009e2
|
@ -29,10 +29,11 @@ enum Tokens
|
|||
KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \
|
||||
KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parts), KW(ptr), \
|
||||
KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
|
||||
KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \
|
||||
KWAT(class), KWAT(const), KWAT(cref), KWAT(empty), KWAT(extern), \
|
||||
KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \
|
||||
KWAT(optional), KWAT(out), KWAT(owned), KWAT(private), KWAT(property), \
|
||||
KWAT(protected), KWAT(restart), KWAT(pure_virtual), KWAT(warn_unused), \
|
||||
KWAT(protected), KWAT(restart), KWAT(pure_virtual), \
|
||||
KWAT(warn_unused), \
|
||||
\
|
||||
KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \
|
||||
KW(long), KW(ulong), KW(llong), KW(ullong), \
|
||||
|
|
|
@ -969,11 +969,12 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
|
|||
{
|
||||
Eina_Bool has_nonull = EINA_FALSE, has_optional = EINA_FALSE,
|
||||
has_nullable = EINA_FALSE, has_owned = EINA_FALSE;
|
||||
Eina_Bool cref = (ls->t.kw == KW_at_cref);
|
||||
Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter));
|
||||
par->param_dir = EOLIAN_IN_PARAM;
|
||||
FILL_BASE(par->base, ls, ls->line_number, ls->column);
|
||||
*params = eina_list_append(*params, par);
|
||||
if (allow_inout && ls->t.kw == KW_at_in)
|
||||
if (cref || (allow_inout && (ls->t.kw == KW_at_in)))
|
||||
{
|
||||
par->param_dir = EOLIAN_IN_PARAM;
|
||||
eo_lexer_get(ls);
|
||||
|
@ -1008,6 +1009,11 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
|
|||
pop_expr(ls);
|
||||
check_match(ls, ')', '(', line, col);
|
||||
}
|
||||
if (cref)
|
||||
{
|
||||
par->type->is_const = EINA_TRUE;
|
||||
par->type->is_ptr = EINA_TRUE;
|
||||
}
|
||||
for (;;) switch (ls->t.kw)
|
||||
{
|
||||
case KW_at_nonull:
|
||||
|
|
Loading…
Reference in New Issue