foo_id->is_class = prop->is_class;
foo_id->keys = prop->keys ; prop->keys = NULL;
- foo_id->params = prop->values; prop->values = NULL;
+ foo_id->params = prop->params; prop->params = NULL;
- if (prop->get_ret)
+ if (prop->get_ret_type)
{
- foo_id->get_ret_type = prop->get_ret->type;
- prop->get_ret->type = NULL;
- foo_id->get_ret_val = prop->get_ret->default_ret_val;
- prop->get_ret->default_ret_val = NULL;
- foo_id->get_return_comment = prop->get_ret->comment;
- prop->get_ret->comment = NULL;
- foo_id->get_return_warn_unused = prop->get_ret->warn_unused;
+ foo_id->get_ret_type = prop->get_ret_type;
+ prop->get_ret_type = NULL;
+ foo_id->get_ret_val = prop->get_ret_val;
+ prop->get_ret_val = NULL;
+ foo_id->get_return_comment = prop->get_return_comment;
+ prop->get_return_comment = NULL;
+ foo_id->get_return_warn_unused = prop->get_return_warn_unused;
}
- if (prop->set_ret)
+ if (prop->set_ret_type)
{
- foo_id->set_ret_type = prop->set_ret->type;
- prop->set_ret->type = NULL;
- foo_id->set_ret_val = prop->set_ret->default_ret_val;
- prop->set_ret->default_ret_val = NULL;
- foo_id->set_return_comment = prop->set_ret->comment;
- prop->set_ret->comment = NULL;
- foo_id->set_return_warn_unused = prop->set_ret->warn_unused;
+ foo_id->set_ret_type = prop->set_ret_type;
+ prop->set_ret_type = NULL;
+ foo_id->set_ret_val = prop->set_ret_val;
+ prop->set_ret_val = NULL;
+ foo_id->set_return_comment = prop->set_return_comment;
+ prop->set_return_comment = NULL;
+ foo_id->set_return_warn_unused = prop->set_return_warn_unused;
}
if (prop->get_legacy)
foo_id->get_only_legacy = prop->get_only_legacy;
foo_id->set_only_legacy = prop->set_only_legacy;
- if (prop->get_comment)
+ if (prop->get_description)
{
- foo_id->get_description = prop->get_comment;
- prop->get_comment = NULL;
+ foo_id->get_description = prop->get_description;
+ prop->get_description = NULL;
}
- if (prop->set_comment)
+ if (prop->set_description)
{
- foo_id->set_description = prop->set_comment;
- prop->set_comment = NULL;
+ foo_id->set_description = prop->set_description;
+ prop->set_description = NULL;
}
+ foo_id->type = prop->type;
+
if (prop->get_accessor)
{
if (kls->type == EOLIAN_CLASS_INTERFACE)
foo_id->get_virtual_pure = EINA_TRUE;
- if (foo_id->type == EOLIAN_PROP_SET)
- foo_id->type = EOLIAN_PROPERTY;
- else
- foo_id->type = EOLIAN_PROP_GET;
foo_id->base = prop->base;
prop->base.file = NULL;
}
{
if (kls->type == EOLIAN_CLASS_INTERFACE)
foo_id->set_virtual_pure = EINA_TRUE;
- if (foo_id->type == EOLIAN_PROP_GET)
- foo_id->type = EOLIAN_PROPERTY;
- else
- foo_id->type = EOLIAN_PROP_SET;
foo_id->set_base = prop->set_base;
prop->set_base.file = NULL;
}
cl->methods = eina_list_append(cl->methods, foo_id);
- if (meth->ret)
+ if (meth->ret_type)
{
- foo_id->get_ret_type = meth->ret->type;
- foo_id->get_return_comment = eina_stringshare_ref(meth->ret->comment);
- foo_id->get_return_warn_unused = meth->ret->warn_unused;
- foo_id->get_ret_val = meth->ret->default_ret_val;
- meth->ret->type = NULL;
- meth->ret->default_ret_val = NULL;
+ foo_id->get_ret_type = meth->ret_type;
+ meth->ret_type = NULL;
+ foo_id->get_return_comment = meth->ret_comment;
+ meth->ret_comment = NULL;
+ foo_id->get_return_warn_unused = meth->ret_warn_unused;
+ foo_id->get_ret_val = meth->default_ret_val;
+ meth->default_ret_val = NULL;
}
foo_id->get_description = eina_stringshare_ref(meth->comment);
#include "eo_definitions.h"
static void
-eo_definitions_ret_free(Eo_Ret_Def *ret)
-{
- if (ret->type) database_type_del(ret->type);
- if (ret->comment) eina_stringshare_del(ret->comment);
- database_expr_del(ret->default_ret_val);
- free(ret);
-}
-
-static void
eo_definitions_property_def_free(Eo_Property_Def *prop)
{
Eolian_Function_Parameter *param;
EINA_LIST_FREE(prop->keys, param)
database_parameter_del(param);
- EINA_LIST_FREE(prop->values, param)
+ EINA_LIST_FREE(prop->params, param)
database_parameter_del(param);
- if (prop->get_comment)
- eina_stringshare_del(prop->get_comment);
+ if (prop->get_description)
+ eina_stringshare_del(prop->get_description);
- if (prop->set_comment)
- eina_stringshare_del(prop->set_comment);
+ if (prop->set_description)
+ eina_stringshare_del(prop->set_description);
if (prop->get_legacy)
eina_stringshare_del(prop->get_legacy);
if (prop->set_legacy)
eina_stringshare_del(prop->set_legacy);
- if (prop->get_ret)
- eo_definitions_ret_free(prop->get_ret);
+ if (prop->get_ret_type)
+ database_type_del(prop->get_ret_type);
+
+ if (prop->set_ret_type)
+ database_type_del(prop->set_ret_type);
- if (prop->set_ret)
- eo_definitions_ret_free(prop->set_ret);
+ if (prop->get_return_comment)
+ eina_stringshare_del(prop->get_return_comment);
+
+ if (prop->set_return_comment)
+ eina_stringshare_del(prop->set_return_comment);
+
+ database_expr_del(prop->get_ret_val);
+ database_expr_del(prop->set_ret_val);
free(prop);
}
if (meth->base.file)
eina_stringshare_del(meth->base.file);
- if (meth->ret)
- eo_definitions_ret_free(meth->ret);
+ if (meth->ret_type)
+ database_type_del(meth->ret_type);
+
+ if (meth->ret_comment)
+ eina_stringshare_del(meth->ret_comment);
+
+ database_expr_del(meth->default_ret_val);
if (meth->name)
eina_stringshare_del(meth->name);
if (tmp->kls)
eo_definitions_class_def_free(tmp->kls);
- if (tmp->ret_def)
- eo_definitions_ret_free(tmp->ret_def);
-
EINA_LIST_FREE(tmp->type_defs, tp)
database_type_del(tp);
#include "eolian_database.h"
-/* RET */
-
-typedef struct _Eo_Ret_Def
-{
- Eolian_Type *type;
- Eina_Stringshare *comment;
- Eolian_Expression *default_ret_val;
- Eina_Bool warn_unused:1;
-} Eo_Ret_Def;
-
/* PROPERTY */
typedef struct _Eo_Property_Def
Eolian_Object base;
Eolian_Object set_base;
Eina_Stringshare *name;
- Eo_Ret_Def *get_ret;
- Eo_Ret_Def *set_ret;
Eina_List *keys;
- Eina_List *values;
- Eina_Stringshare *get_comment;
- Eina_Stringshare *set_comment;
+ Eina_List *params;
+ Eolian_Function_Type type;
+ Eolian_Object_Scope scope;
+ Eolian_Type *get_ret_type;
+ Eolian_Type *set_ret_type;
+ Eolian_Expression *get_ret_val;
+ Eolian_Expression *set_ret_val;
+ Eina_Stringshare *get_return_comment;
+ Eina_Stringshare *set_return_comment;
Eina_Stringshare *get_legacy;
Eina_Stringshare *set_legacy;
- int scope;
+ Eina_Stringshare *get_description;
+ Eina_Stringshare *set_description;
Eina_Bool get_accessor: 1;
Eina_Bool set_accessor: 1;
+ Eina_Bool get_return_warn_unused :1; /* also used for methods */
+ Eina_Bool set_return_warn_unused :1;
Eina_Bool get_only_legacy: 1;
Eina_Bool set_only_legacy: 1;
Eina_Bool is_class:1;
typedef struct _Eo_Method_Def
{
Eolian_Object base;
- Eo_Ret_Def *ret;
+ Eolian_Type *ret_type;
+ Eina_Stringshare *ret_comment;
+ Eolian_Expression *default_ret_val;
Eina_Stringshare *name;
Eina_Stringshare *comment;
Eina_List *params;
int scope;
Eina_Bool is_class:1;
Eina_Bool only_legacy:1;
+ Eina_Bool ret_warn_unused:1;
} Eo_Method_Def;
/* CLASS */
Eina_List *params;
Eina_Stringshare *legacy_def;
Eo_Class_Def *kls;
- Eo_Ret_Def *ret_def;
Eina_List *type_defs;
Eina_List *var_defs;
Eo_Property_Def *prop;
return def;
}
+typedef struct _Eo_Ret_Def
+{
+ Eolian_Type *type;
+ Eina_Stringshare *comment;
+ Eolian_Expression *default_ret_val;
+ Eina_Bool warn_unused:1;
+} Eo_Ret_Def;
+
static void
-parse_return(Eo_Lexer *ls, Eina_Bool allow_void)
+parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void)
{
- Eo_Ret_Def *ret = calloc(1, sizeof(Eo_Ret_Def));
- ls->tmp.ret_def = ret;
eo_lexer_get(ls);
check_next(ls, ':');
if (allow_void)
ret->type = parse_type_void(ls);
else
ret->type = parse_type(ls);
- pop_type(ls);
+ ret->comment = NULL;
+ ret->default_ret_val = NULL;
+ ret->warn_unused = EINA_FALSE;
if (ls->t.token == '(')
{
int line = ls->line_number, col = ls->column;
eo_lexer_get(ls);
ret->default_ret_val = parse_expr(ls);
ls->expr_mode = EINA_FALSE;
- pop_expr(ls);
check_match(ls, ')', '(', line, col);
}
if (ls->t.kw == KW_at_warn_unused)
prop->base.line = ls->line_number;
prop->base.column = ls->column;
prop->get_accessor = EINA_TRUE;
+ if (prop->type == EOLIAN_PROP_SET)
+ prop->type = EOLIAN_PROPERTY;
+ else
+ prop->type = EOLIAN_PROP_GET;
}
else
{
prop->set_base.line = ls->line_number;
prop->set_base.column = ls->column;
prop->set_accessor = EINA_TRUE;
+ if (prop->type == EOLIAN_PROP_GET)
+ prop->type = EOLIAN_PROPERTY;
+ else
+ prop->type = EOLIAN_PROP_SET;
}
eo_lexer_get(ls);
line = ls->line_number;
if (ls->t.token == TOK_COMMENT)
{
if (is_get)
- prop->get_comment = eina_stringshare_ref(ls->t.value.s);
+ prop->get_description = eina_stringshare_ref(ls->t.value.s);
else
- prop->set_comment = eina_stringshare_ref(ls->t.value.s);
+ prop->set_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
for (;;) switch (ls->t.kw)
{
case KW_return:
CASE_LOCK(ls, return, "return")
- parse_return(ls, is_get);
+ Eo_Ret_Def ret;
+ parse_return(ls, &ret, is_get);
+ pop_type(ls);
+ if (ret.default_ret_val) pop_expr(ls);
if (is_get)
- prop->get_ret = ls->tmp.ret_def;
+ {
+ prop->get_ret_type = ret.type;
+ prop->get_return_comment = ret.comment;
+ prop->get_ret_val = ret.default_ret_val;
+ prop->get_return_warn_unused = ret.warn_unused;
+ }
else
- prop->set_ret = ls->tmp.ret_def;
- ls->tmp.ret_def = NULL;
+ {
+ prop->set_ret_type = ret.type;
+ prop->set_return_comment = ret.comment;
+ prop->set_ret_val = ret.default_ret_val;
+ prop->set_return_warn_unused = ret.warn_unused;
+ }
break;
case KW_legacy:
CASE_LOCK(ls, legacy, "legacy name")
case KW_values:
CASE_LOCK(ls, values, "values definition")
parse_params(ls, EINA_FALSE, EINA_TRUE);
- prop->values = ls->tmp.params;
+ prop->params = ls->tmp.params;
ls->tmp.params = NULL;
break;
default:
{
case KW_return:
CASE_LOCK(ls, return, "return")
- parse_return(ls, EINA_FALSE);
- meth->ret = ls->tmp.ret_def;
- ls->tmp.ret_def = NULL;
+ Eo_Ret_Def ret;
+ parse_return(ls, &ret, EINA_FALSE);
+ pop_type(ls);
+ if (ret.default_ret_val) pop_expr(ls);
+ meth->ret_type = ret.type;
+ meth->ret_comment = ret.comment;
+ meth->default_ret_val = ret.default_ret_val;
+ meth->ret_warn_unused = ret.warn_unused;
break;
case KW_legacy:
CASE_LOCK(ls, legacy, "legacy name")