Eolian: add support for property descriptions.
authorDaniel Zaoui <daniel.zaoui@samsung.com>
Sun, 19 Oct 2014 08:17:39 +0000 (11:17 +0300)
committerDaniel Zaoui <daniel.zaoui@samsung.com>
Sun, 19 Oct 2014 10:25:06 +0000 (13:25 +0300)
For properties, set and get descriptions were supported but common
comment was not.

src/lib/eolian/database_function.c
src/lib/eolian/database_function_api.c
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.h
src/tests/eolian/data/class_simple.eo
src/tests/eolian/eolian_parsing.c

index c85b8acab1d04e909c4f3698c1cebd96a22d33ce..48fdd3055402e20e87ed150fd86e75240834ce56 100644 (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);
index 95bf12c6b908ab517426e090442d0db07d0dd20f..000dda6c78be574d587809879ed64530fa636deb 100644 (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;
      }
 }
 
index c14efa7bd40fa2b19b95f4dd46a125d6da241328..5c2ada78dff6a11ff47e29f16ef3b3a55008653b 100644 (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)
index acf8e61369a79ea6fffa60c8d6710c8293ef3a4b..ddf50a4787d2131819bc00c34816ffc44d6fe7c5 100644 (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;
index a64a9aa891905df64f89d7b4c2d463ba3c1b0aa5..1f0ae65886f02f157ebb66fad94246b0513c567f 100644 (file)
@@ -5,6 +5,7 @@ class Class_Simple {
    data: Evas_Simple_Data;
    properties {
       a {
+         /*@ Common desc for a */
          set {
             /*@
             comment a.set */
index 2f10ec7d0f3e2bd2ce3a5e201a7d79078a278ddc..d71464b152ee62b6c46c243e3a82b1c00f9b334b 100644 (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"));