summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-12-24 07:26:33 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2019-12-24 07:26:33 +0900
commitb3cc7d403b4a9f69f2ad8c4bbd37e482f34e6deb (patch)
tree02b1f8f165a56a47462c652983268348a2c3e049
parent5679a5d2a2d96d076e7f0a7309b01b04f1aad606 (diff)
eolian: inherit since information from struct and enum to field
Summary: If a struct or enum field doesn't explicitly sets since information, then since is inherited from struct documentation if it is available. Reviewers: jptiz, Jaehyun_Cho, woohyun, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8359 Differential Revision: https://phab.enlightenment.org/D10948
-rw-r--r--src/lib/eolian/eo_parser.c4
-rw-r--r--src/tests/eolian/data/docs_ref.h18
-rw-r--r--src/tests/eolian/data/eo_docs.eo4
-rw-r--r--src/tests/eolian/eolian_parsing.c3
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_documentation.cc4
5 files changed, 25 insertions, 8 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 96de7a77ec..253e99e929 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -536,6 +536,8 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
536qual_end: 536qual_end:
537 check_next(ls, ';'); 537 check_next(ls, ';');
538 FILL_DOC(ls, fdef, doc); 538 FILL_DOC(ls, fdef, doc);
539 if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since)
540 fdef->doc->since = eina_stringshare_ref (def->doc->since);
539 } 541 }
540 check_match(ls, '}', '{', bline, bcolumn); 542 check_match(ls, '}', '{', bline, bcolumn);
541 FILL_BASE(def->base, ls, line, column, TYPEDECL); 543 FILL_BASE(def->base, ls, line, column, TYPEDECL);
@@ -656,6 +658,8 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
656 if (want_next) 658 if (want_next)
657 eo_lexer_get(ls); 659 eo_lexer_get(ls);
658 FILL_DOC(ls, fdef, doc); 660 FILL_DOC(ls, fdef, doc);
661 if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since)
662 fdef->doc->since = eina_stringshare_ref (def->doc->since);
659 if (!want_next || ls->t.token == '}') 663 if (!want_next || ls->t.token == '}')
660 break; 664 break;
661 } 665 }
diff --git a/src/tests/eolian/data/docs_ref.h b/src/tests/eolian/data/docs_ref.h
index 158b814ae0..a00fafb5a5 100644
--- a/src/tests/eolian/data/docs_ref.h
+++ b/src/tests/eolian/data/docs_ref.h
@@ -29,20 +29,30 @@ typedef Eo Eo_Docs;
29 */ 29 */
30typedef struct _Foo 30typedef struct _Foo
31{ 31{
32 int field1; /**< Field documentation. */ 32 int field1; /**< Field documentation.
33 *
34 * @since 1.66 */
33 float field2; 35 float field2;
34 short field3; /**< Another field documentation. */ 36 short field3; /**< Another field documentation.
37 *
38 * @since 1.66 */
35} Foo; 39} Foo;
36 40
37/** Docs for enum Bar. 41/** Docs for enum Bar.
38 * 42 *
43 * @since 1.55
44 *
39 * @ingroup Bar 45 * @ingroup Bar
40 */ 46 */
41typedef enum 47typedef enum
42{ 48{
43 BAR_BLAH = 0, 49 BAR_BLAH = 0,
44 BAR_FOO = 1, /**< Docs for foo. */ 50 BAR_FOO = 1, /**< Docs for foo.
45 BAR_BAR = 2 /**< Docs for bar. */ 51 *
52 * @since 1.55 */
53 BAR_BAR = 2 /**< Docs for bar.
54 *
55 * @since 1.55 */
46} Bar; 56} Bar;
47 57
48/** 58/**
diff --git a/src/tests/eolian/data/eo_docs.eo b/src/tests/eolian/data/eo_docs.eo
index d42cdfcd95..8c62559d5a 100644
--- a/src/tests/eolian/data/eo_docs.eo
+++ b/src/tests/eolian/data/eo_docs.eo
@@ -19,7 +19,9 @@ struct Foo {
19} 19}
20 20
21enum Bar { 21enum Bar {
22 [[Docs for enum Bar.]] 22 [[Docs for enum Bar.
23 @since 1.55
24 ]]
23 blah = 0, 25 blah = 0,
24 foo = 1, [[Docs for foo.]] 26 foo = 1, [[Docs for foo.]]
25 bar = 2 [[Docs for bar.]] 27 bar = 2 [[Docs for bar.]]
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index ac06f99eba..9d137dcec3 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1150,7 +1150,8 @@ EFL_START_TEST(eolian_docs)
1150 fail_if(strcmp(eolian_documentation_summary_get(doc), 1150 fail_if(strcmp(eolian_documentation_summary_get(doc),
1151 "Docs for enum Bar.")); 1151 "Docs for enum Bar."));
1152 fail_if(eolian_documentation_description_get(doc)); 1152 fail_if(eolian_documentation_description_get(doc));
1153 fail_if(eolian_documentation_since_get(doc)); 1153 fail_if(strcmp(eolian_documentation_since_get(doc),
1154 "1.55"));
1154 1155
1155 fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "blah"))); 1156 fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "blah")));
1156 fail_if(eolian_typedecl_enum_field_documentation_get(efl)); 1157 fail_if(eolian_typedecl_enum_field_documentation_get(efl));
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
index 961519d16e..eb683e3312 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
@@ -279,7 +279,7 @@ EFL_START_TEST(eolian_cxx_test_struct_docs)
279 doc = field_iter->documentation; 279 doc = field_iter->documentation;
280 ck_assert_str_eq(doc.summary.c_str(), "Field documentation."); 280 ck_assert_str_eq(doc.summary.c_str(), "Field documentation.");
281 ck_assert_str_eq(doc.description.c_str(), ""); 281 ck_assert_str_eq(doc.description.c_str(), "");
282 ck_assert_str_eq(doc.since.c_str(), ""); 282 ck_assert_str_eq(doc.since.c_str(), "1.66");
283 283
284 field_iter++; 284 field_iter++;
285 285
@@ -293,7 +293,7 @@ EFL_START_TEST(eolian_cxx_test_struct_docs)
293 doc = field_iter->documentation; 293 doc = field_iter->documentation;
294 ck_assert_str_eq(doc.summary.c_str(), "Another field documentation."); 294 ck_assert_str_eq(doc.summary.c_str(), "Another field documentation.");
295 ck_assert_str_eq(doc.description.c_str(), ""); 295 ck_assert_str_eq(doc.description.c_str(), "");
296 ck_assert_str_eq(doc.since.c_str(), ""); 296 ck_assert_str_eq(doc.since.c_str(), "1.66");
297} 297}
298EFL_END_TEST 298EFL_END_TEST
299 299