diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-11-01 12:00:14 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-11-01 12:40:39 +0100 |
commit | eab6f009e25a34492e0fd69a283d135df7a60d25 (patch) | |
tree | 387e79a7e263a1d69921910ffb5f5f1a0c631aed /src/lib | |
parent | 0496b7988ab8df1c20874ebc81c8ff909aee58e1 (diff) | |
download | efl-eab6f009e25a34492e0fd69a283d135df7a60d25.tar.gz |
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.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eolian/eo_lexer.h | 5 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 9168ad946c..18d6f7e2f0 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -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), \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 2250ddaa01..0ec492b9a3 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -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: |