summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-11-01 12:00:14 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-11-01 12:40:39 +0100
commiteab6f009e25a34492e0fd69a283d135df7a60d25 (patch)
tree387e79a7e263a1d69921910ffb5f5f1a0c631aed /src
parent0496b7988ab8df1c20874ebc81c8ff909aee58e1 (diff)
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')
-rw-r--r--src/lib/eolian/eo_lexer.h5
-rw-r--r--src/lib/eolian/eo_parser.c8
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
29 KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \ 29 KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \
30 KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parts), KW(ptr), \ 30 KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parts), KW(ptr), \
31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \ 31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
32 KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \ 32 KWAT(class), KWAT(const), KWAT(cref), KWAT(empty), KWAT(extern), \
33 KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \ 33 KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \
34 KWAT(optional), KWAT(out), KWAT(owned), KWAT(private), KWAT(property), \ 34 KWAT(optional), KWAT(out), KWAT(owned), KWAT(private), KWAT(property), \
35 KWAT(protected), KWAT(restart), KWAT(pure_virtual), KWAT(warn_unused), \ 35 KWAT(protected), KWAT(restart), KWAT(pure_virtual), \
36 KWAT(warn_unused), \
36 \ 37 \
37 KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ 38 KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \
38 KW(long), KW(ulong), KW(llong), KW(ullong), \ 39 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,
969{ 969{
970 Eina_Bool has_nonull = EINA_FALSE, has_optional = EINA_FALSE, 970 Eina_Bool has_nonull = EINA_FALSE, has_optional = EINA_FALSE,
971 has_nullable = EINA_FALSE, has_owned = EINA_FALSE; 971 has_nullable = EINA_FALSE, has_owned = EINA_FALSE;
972 Eina_Bool cref = (ls->t.kw == KW_at_cref);
972 Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter)); 973 Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter));
973 par->param_dir = EOLIAN_IN_PARAM; 974 par->param_dir = EOLIAN_IN_PARAM;
974 FILL_BASE(par->base, ls, ls->line_number, ls->column); 975 FILL_BASE(par->base, ls, ls->line_number, ls->column);
975 *params = eina_list_append(*params, par); 976 *params = eina_list_append(*params, par);
976 if (allow_inout && ls->t.kw == KW_at_in) 977 if (cref || (allow_inout && (ls->t.kw == KW_at_in)))
977 { 978 {
978 par->param_dir = EOLIAN_IN_PARAM; 979 par->param_dir = EOLIAN_IN_PARAM;
979 eo_lexer_get(ls); 980 eo_lexer_get(ls);
@@ -1008,6 +1009,11 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
1008 pop_expr(ls); 1009 pop_expr(ls);
1009 check_match(ls, ')', '(', line, col); 1010 check_match(ls, ')', '(', line, col);
1010 } 1011 }
1012 if (cref)
1013 {
1014 par->type->is_const = EINA_TRUE;
1015 par->type->is_ptr = EINA_TRUE;
1016 }
1011 for (;;) switch (ls->t.kw) 1017 for (;;) switch (ls->t.kw)
1012 { 1018 {
1013 case KW_at_nonull: 1019 case KW_at_nonull: