Eolian: add support for property descriptions.

For properties, set and get descriptions were supported but common
comment was not.
This commit is contained in:
Daniel Zaoui 2014-10-19 11:17:39 +03:00
parent 5718763ca3
commit af513b6af3
6 changed files with 10 additions and 4 deletions

View File

@ -25,6 +25,7 @@ database_function_del(Eolian_Function *fid)
if (fid->set_legacy) eina_stringshare_del(fid->set_legacy);
if (fid->get_description) eina_stringshare_del(fid->get_description);
if (fid->set_description) eina_stringshare_del(fid->set_description);
if (fid->common_description) eina_stringshare_del(fid->common_description);
if (fid->get_return_comment) eina_stringshare_del(fid->get_return_comment);
if (fid->set_return_comment) eina_stringshare_del(fid->set_return_comment);
free(fid);

View File

@ -92,9 +92,9 @@ eolian_function_description_get(const Eolian_Function *fid, Eolian_Function_Type
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
switch (ftype)
{
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_description; break;
case EOLIAN_PROP_GET: return fid->get_description; break;
case EOLIAN_PROP_SET: return fid->set_description; break;
default: return NULL;
default: return fid->common_description;
}
}

View File

@ -1359,7 +1359,7 @@ body:
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
/* just consume the comment for now */
prop->common_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
for (;;) switch (ls->t.kw)
@ -1455,7 +1455,7 @@ body:
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
meth->get_description = eina_stringshare_ref(ls->t.value.s);
meth->common_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
for (;;) switch (ls->t.kw)

View File

@ -101,6 +101,7 @@ struct _Eolian_Function
Eolian_Implement *set_impl;
Eina_Stringshare *get_legacy;
Eina_Stringshare *set_legacy;
Eina_Stringshare *common_description;
Eina_Stringshare *get_description;
Eina_Stringshare *set_description;
Eina_Stringshare *get_return_comment;

View File

@ -5,6 +5,7 @@ class Class_Simple {
data: Evas_Simple_Data;
properties {
a {
/*@ Common desc for a */
set {
/*@
comment a.set */

View File

@ -548,6 +548,9 @@ START_TEST(eolian_simple_parsing)
/* Property */
fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY)));
fail_if(strcmp(eolian_function_name_get(fid), "a"));
string = eolian_function_description_get(fid, EOLIAN_PROPERTY);
fail_if(!string);
fail_if(strcmp(string, "Common desc for a"));
string = eolian_function_description_get(fid, EOLIAN_PROP_SET);
fail_if(!string);
fail_if(strcmp(string, "comment a.set"));