eolian: remove accessor params feature

Temporarily replace it with @const_get and @const_set tags in values section.
This commit is contained in:
Daniel Kolesa 2014-09-10 15:06:12 +01:00
parent 9aff324457
commit f86c2d4e5a
9 changed files with 25 additions and 104 deletions

View File

@ -128,10 +128,9 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
if there was none, and on errors.
@see edje_object_perspective_set() */
ps: const;
}
values {
Edje_Perspective *ps; /*@ The perspective object that will be used. */
Edje_Perspective *ps @const_get; /*@ The perspective object that will be used. */
}
}
scale {

View File

@ -2,11 +2,8 @@
static Eina_Bool
_db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
Eo_Property_Def *prop, Eo_Accessor_Def *accessor)
Eo_Accessor_Def *accessor)
{
Eo_Accessor_Param *acc_param;
Eina_List *l;
if (accessor->type == SETTER)
foo_id->type = (foo_id->type == EOLIAN_PROP_GET) ? EOLIAN_PROPERTY
: EOLIAN_PROP_SET;
@ -49,26 +46,6 @@ _db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
foo_id->get_only_legacy = accessor->only_legacy;
}
EINA_LIST_FOREACH(accessor->params, l, acc_param)
{
Eolian_Function_Parameter *desc = (Eolian_Function_Parameter*)
eolian_function_parameter_get_by_name(foo_id, acc_param->name);
if (!desc)
{
ERR("Error - %s not known as parameter of property %s\n",
acc_param->name, prop->name);
return EINA_FALSE;
}
else if (acc_param->is_const)
{
if (accessor->type == GETTER)
desc->is_const_on_get = EINA_TRUE;
else
desc->is_const_on_set = EINA_TRUE;
}
}
if (kls->type == EOLIAN_CLASS_INTERFACE)
{
if (accessor->type == SETTER)
@ -95,7 +72,7 @@ _db_fill_accessors(Eolian_Function *foo_id, Eo_Class_Def *kls,
Eina_List *l;
EINA_LIST_FOREACH(prop->accessors, l, accessor)
if (!_db_fill_accessor(foo_id, kls, prop, accessor)) return EINA_FALSE;
if (!_db_fill_accessor(foo_id, kls, accessor)) return EINA_FALSE;
return EINA_TRUE;
}

View File

@ -12,13 +12,6 @@ eo_definitions_ret_free(Eo_Ret_Def *ret)
free(ret);
}
static void
eo_definitions_accessor_param_free(Eo_Accessor_Param *param)
{
if (param->name) eina_stringshare_del(param->name);
free(param);
}
static void
eo_definitions_accessor_free(Eo_Accessor_Def *accessor)
{
@ -31,10 +24,6 @@ eo_definitions_accessor_free(Eo_Accessor_Def *accessor)
if (accessor->legacy)
eina_stringshare_del(accessor->legacy);
Eo_Accessor_Param *param;
EINA_LIST_FREE(accessor->params, param)
eo_definitions_accessor_param_free(param);
if (accessor->ret)
eo_definitions_ret_free(accessor->ret);
@ -176,9 +165,6 @@ eo_definitions_temps_free(Eo_Lexer_Temps *tmp)
if (tmp->accessor)
eo_definitions_accessor_free(tmp->accessor);
if (tmp->accessor_param)
eo_definitions_accessor_param_free(tmp->accessor_param);
EINA_LIST_FREE(tmp->str_items, s)
if (s) eina_stringshare_del(s);

View File

@ -24,12 +24,6 @@ typedef enum _Eo_Accessor_Type
GETTER
} Eo_Accessor_Type;
typedef struct _Eo_Accessor_Param
{
Eina_Stringshare *name;
Eina_Bool is_const:1;
} Eo_Accessor_Param;
typedef struct _Eo_Accessor_Def
{
Eolian_Object base;
@ -37,7 +31,6 @@ typedef struct _Eo_Accessor_Def
Eo_Ret_Def *ret;
Eina_Stringshare *comment;
Eina_Stringshare* legacy;
Eina_List *params; /* List of Eo_Accessor_Param */
Eina_Bool only_legacy:1;
} Eo_Accessor_Def;
@ -105,7 +98,6 @@ typedef struct _Eo_Lexer_Temps
Eo_Method_Def *meth;
Eolian_Function_Parameter *param;
Eo_Accessor_Def *accessor;
Eo_Accessor_Param *accessor_param;
Eina_List *str_items;
Eolian_Event *event;
Eolian_Implement *impl;

View File

@ -28,9 +28,9 @@ 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(empty), KWAT(extern), KWAT(free), \
KWAT(in), KWAT(inout), KWAT(nonull), KWAT(out), KWAT(private), \
KWAT(protected), KWAT(virtual), KWAT(warn_unused), \
KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), KWAT(empty), \
KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(out), \
KWAT(private), KWAT(protected), KWAT(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), \

View File

@ -1177,6 +1177,20 @@ parse_param(Eo_Lexer *ls, Eina_Bool allow_inout, Eina_Bool is_vals)
pop_expr(ls);
check_match(ls, ')', '(', line, col);
}
/* XXX: remove this fugly bit - temporary */
if (is_vals)
{
if (ls->t.kw == KW_at_const_get)
{
par->is_const_on_get = EINA_TRUE;
eo_lexer_get(ls);
}
else if (ls->t.kw == KW_at_const_set)
{
par->is_const_on_set = EINA_TRUE;
eo_lexer_get(ls);
}
}
if (ls->t.kw == KW_at_nonull)
{
par->nonull = EINA_TRUE;
@ -1201,33 +1215,6 @@ parse_legacy(Eo_Lexer *ls)
check_next(ls, ';');
}
static void
parse_attrs(Eo_Lexer *ls)
{
Eo_Accessor_Param *acc = NULL;
Eina_Bool has_const = EINA_FALSE;
acc = calloc(1, sizeof(Eo_Accessor_Param));
ls->tmp.accessor_param = acc;
acc->name = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
check_next(ls, ':');
check(ls, TOK_VALUE);
for (;;) switch (ls->t.kw)
{
case KW_const:
CASE_LOCK(ls, const, "const qualifier")
acc->is_const = EINA_TRUE;
eo_lexer_get(ls);
break;
default:
if (ls->t.token != ';')
eo_lexer_syntax_error(ls, "attribute expected");
goto end;
}
end:
check_next(ls, ';');
}
static void
parse_accessor(Eo_Lexer *ls)
{
@ -1273,23 +1260,7 @@ parse_accessor(Eo_Lexer *ls)
acc->only_legacy = EINA_TRUE;
break;
default:
if (ls->t.token != '}')
{
check(ls, TOK_VALUE);
parse_attrs(ls);
acc->params = eina_list_append(acc->params,
ls->tmp.accessor_param);
ls->tmp.accessor_param = NULL;
/* this code path is disabled for the time being,
* it's not used in regular eolian yet either...
eo_lexer_lookahead(ls);
if (ls->lookahead.token == ':')
parse_attrs(ls);
else
parse_param(ls, EINA_TRUE);*/
}
else
goto end;
goto end;
}
end:
check_match(ls, '}', '{', line, col);

View File

@ -328,10 +328,9 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
@since 1.1
This function returns the video surface linked to a given canvas image. */
surf: const;
}
values {
Evas_Video_Surface *surf; /*@ The new video surface.
Evas_Video_Surface *surf @const_get; /*@ The new video surface.
@since 1.1 */
}
}
@ -541,10 +540,9 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image)
@return The native surface of the given canvas image.
This function returns the native surface of a given canvas image. */
/*surf: const;*/
}
values {
Evas_Native_Surface *surf @nonull; /*@ The new native surface. */
Evas_Native_Surface *surf/* @const_get*/ @nonull; /*@ The new native surface. */
}
}
load_scale_down {

View File

@ -5,11 +5,10 @@ class Consts {
return: bool (true); /*@ comment for property set return */
}
get {
buffer: const;
}
values {
int value; /*@ Value description */
char *buffer;
char *buffer @const_get;
}
}
}

View File

@ -3,7 +3,6 @@ class Object_Impl (Base) {
a {
set {
return: bool (false);
value: const;
}
get {
}
@ -11,7 +10,7 @@ class Object_Impl (Base) {
const(char)* part;
}
values {
own(list<int>*) value;
own(list<int>*) value @const_set;
}
}
b {