summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-11 21:45:03 +0000
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-10-12 19:18:13 -0300
commit5516b06af58c4a5210b35c8c9b8e011cf5320c55 (patch)
tree8d2f4842d2cb33ab3adef9471325c5e71dd8b658
parentb1a1cdc701add170f1e6adf68573828bf13bf496 (diff)
eolian-cxx: Make events inherit beta info from klass.
To mimic function behavior Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10381
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp2
-rw-r--r--src/tests/eolian_cxx/beta_class.eo8
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_binding.cc27
3 files changed, 36 insertions, 1 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 5b977a6c57..0dd6779778 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -1188,7 +1188,7 @@ struct event_def
1188 } : eina::optional<type_def>{}) 1188 } : eina::optional<type_def>{})
1189 , name( ::eolian_event_name_get(event)) 1189 , name( ::eolian_event_name_get(event))
1190 , c_name( ::eolian_event_c_macro_get(event)) 1190 , c_name( ::eolian_event_c_macro_get(event))
1191 , is_beta( ::eolian_event_is_beta(event)) 1191 , is_beta( ::eolian_event_is_beta(event) || klass.is_beta)
1192 , is_protected( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED) 1192 , is_protected( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED)
1193 , documentation( ::eolian_event_documentation_get(event)) {} 1193 , documentation( ::eolian_event_documentation_get(event)) {}
1194}; 1194};
diff --git a/src/tests/eolian_cxx/beta_class.eo b/src/tests/eolian_cxx/beta_class.eo
index ba91bf7660..be796f1ab5 100644
--- a/src/tests/eolian_cxx/beta_class.eo
+++ b/src/tests/eolian_cxx/beta_class.eo
@@ -1,3 +1,11 @@
1class @beta Beta_Class extends Efl.Object 1class @beta Beta_Class extends Efl.Object
2{ 2{
3 methods {
4 method_should_be_beta {
5 [[ Method should be beta ]]
6 }
7 }
8 events {
9 event_should_be_beta: void; [[ Event should be beta.]]
10 }
3} 11}
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
index ad2d48552d..ef50b58f49 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
@@ -191,6 +191,7 @@ using efl::eolian::grammar::attributes::klass_def;
191using efl::eolian::grammar::attributes::function_def; 191using efl::eolian::grammar::attributes::function_def;
192using efl::eolian::grammar::attributes::property_def; 192using efl::eolian::grammar::attributes::property_def;
193using efl::eolian::grammar::attributes::type_def; 193using efl::eolian::grammar::attributes::type_def;
194using efl::eolian::grammar::attributes::event_def;
194 195
195// FIXME Unify this definition some so we can share it with documentation tests. 196// FIXME Unify this definition some so we can share it with documentation tests.
196static 197static
@@ -318,6 +319,31 @@ EFL_START_TEST(eolian_cxx_test_beta)
318} 319}
319EFL_END_TEST 320EFL_END_TEST
320 321
322EFL_START_TEST(eolian_cxx_test_beta_cascading)
323{
324 efl::eolian::eolian_init eolian_init;
325 efl::eolian::eolian_state eolian_state;
326
327 klass_def cls = init_test_data("beta_class.eo", "Beta_Class", eolian_state);
328
329 ck_assert(cls.is_beta);
330
331 auto func = std::find_if(cls.functions.begin(), cls.functions.end(), [](function_def const& f) {
332 return f.name == "method_should_be_beta";
333 });
334
335 ck_assert(func != cls.functions.end());
336 ck_assert(func->is_beta);
337
338 auto evt = std::find_if(cls.events.begin(), cls.events.end(), [](event_def const& e) {
339 return e.name == "event_should_be_beta";
340 });
341
342 ck_assert(evt != cls.events.end());
343 ck_assert(evt->is_beta);
344}
345EFL_END_TEST
346
321void 347void
322eolian_cxx_test_binding(TCase* tc) 348eolian_cxx_test_binding(TCase* tc)
323{ 349{
@@ -333,4 +359,5 @@ eolian_cxx_test_binding(TCase* tc)
333 tcase_add_test(tc, eolian_cxx_test_cls_get); 359 tcase_add_test(tc, eolian_cxx_test_cls_get);
334 tcase_add_test(tc, eolian_cxx_test_constructors); 360 tcase_add_test(tc, eolian_cxx_test_constructors);
335 tcase_add_test(tc, eolian_cxx_test_beta); 361 tcase_add_test(tc, eolian_cxx_test_beta);
362 tcase_add_test(tc, eolian_cxx_test_beta_cascading);
336} 363}