From: Lauro Moura Date: Fri, 14 Dec 2018 20:52:56 +0000 (-0200) Subject: eolian-cxx: Add parent/extensions information to klass_def X-Git-Tag: submit/tizen/20181218.080725~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c25a7dd41cfc6c0506982533a9b25e26c3c86455;p=platform%2Fupstream%2Fefl.git eolian-cxx: Add parent/extensions information to klass_def Summary: Following new Eolian api. Test Plan: Run newly added test Reviewers: vitor.sousa, felipealmeida Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7459 --- diff --git a/src/Makefile_Eolian_Cxx.am b/src/Makefile_Eolian_Cxx.am index be0cbaf..9b6c32e 100644 --- a/src/Makefile_Eolian_Cxx.am +++ b/src/Makefile_Eolian_Cxx.am @@ -110,14 +110,14 @@ endif tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-name1_name2_type_generation.$(OBJEXT): tests/eolian_cxx/name1_name2_type_generation.eo.h tests/eolian_cxx/name1_name2_type_generation.eo.c tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_inheritance.$(OBJEXT): tests/eolian_cxx/simple.eo.hh tests/eolian_cxx/simple.eo.h -tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_binding.$(OBJEXT): tests/eolian_cxx/generic.eo.hh tests/eolian_cxx/generic.eo.h tests/eolian_cxx/name1_name2_type_generation.eo.hh tests/eolian_cxx/name1_name2_type_generation.eo.h tests/eolian_cxx/name1_name2_type_generation.eo.c +tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_binding.$(OBJEXT): tests/eolian_cxx/generic.eo.hh tests/eolian_cxx/generic.eo.h tests/eolian_cxx/generic.eo.c tests/eolian_cxx/generic_interface.eo.hh tests/eolian_cxx/generic_interface.eo.h tests/eolian_cxx/generic_interface.eo.c tests/eolian_cxx/name1_name2_type_generation.eo.hh tests/eolian_cxx/name1_name2_type_generation.eo.h tests/eolian_cxx/name1_name2_type_generation.eo.c tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_address_of.$(OBJEXT): tests/eolian_cxx/a.eo.hh tests/eolian_cxx/b.eo.hh tests/eolian_cxx/c.eo.hh tests/eolian_cxx/d.eo.hh tests/eolian_cxx/a.eo.h tests/eolian_cxx/b.eo.h tests/eolian_cxx/c.eo.h tests/eolian_cxx/d.eo.h tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_cyclic.$(OBJEXT): tests/eolian_cxx/cyclic1.eo.hh tests/eolian_cxx/cyclic2.eo.hh tests/eolian_cxx/cyclic1.eo.c tests/eolian_cxx/cyclic2.eo.c tests/eolian_cxx/cyclic1.eo.h tests/eolian_cxx/cyclic2.eo.h tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-eolian_cxx_test_wrapper.$(OBJEXT): tests/eolian_cxx/a.eo.h tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.hh tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-simple.$(OBJEXT): tests/eolian_cxx/simple.eo.c tests/eolian_cxx/simple.eo.h -tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-generic.$(OBJEXT): tests/eolian_cxx/generic.eo.c tests/eolian_cxx/generic.eo.h +tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-generic.$(OBJEXT): tests/eolian_cxx/generic.eo.c tests/eolian_cxx/generic.eo.h tests/eolian_cxx/generic_interface.eo.c tests/eolian_cxx/generic_interface.eo.h tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-a.$(OBJEXT): tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-b.$(OBJEXT): tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-c.$(OBJEXT): tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h @@ -138,6 +138,10 @@ tests/eolian_cxx/generic.eo.c \ tests/eolian_cxx/generic.eo.h \ tests/eolian_cxx/generic.eo.hh \ tests/eolian_cxx/generic.eo.impl.hh \ +tests/eolian_cxx/generic_interface.eo.c \ +tests/eolian_cxx/generic_interface.eo.h \ +tests/eolian_cxx/generic_interface.eo.hh \ +tests/eolian_cxx/generic_interface.eo.impl.hh \ tests/eolian_cxx/a.eo.hh tests/eolian_cxx/a.eo.impl.hh tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h \ tests/eolian_cxx/b.eo.hh tests/eolian_cxx/b.eo.impl.hh tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h \ tests/eolian_cxx/c.eo.hh tests/eolian_cxx/c.eo.impl.hh tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h \ @@ -198,6 +202,7 @@ endif EXTRA_DIST2 += \ tests/eolian_cxx/simple.eo \ tests/eolian_cxx/generic.eo \ +tests/eolian_cxx/generic_interface.eo \ tests/eolian_cxx/docs.eo \ tests/eolian_cxx/a.eo \ tests/eolian_cxx/b.eo \ diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 08240b6..ce54f35 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -987,6 +987,9 @@ struct klass_def class_type type; std::vector events; std::set immediate_inherits; + eina::optional parent; + std::set extensions; + std::set parts; Eolian_Unit const* unit; @@ -1108,12 +1111,17 @@ struct klass_def } catch(std::exception const&) {} } if(::eolian_class_parent_get(klass)) - immediate_inherits.insert({::eolian_class_parent_get(klass), {}}); + { + parent = eina::optional({::eolian_class_parent_get(klass), {}}); + immediate_inherits.insert(*parent); + } for(efl::eina::iterator inherit_iterator ( ::eolian_class_extensions_get(klass)) , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) { Eolian_Class const* inherit = &*inherit_iterator; - immediate_inherits.insert({inherit, {}}); + klass_name extension(inherit, {}); + immediate_inherits.insert(extension); + extensions.insert(extension); } std::function inherit_algo = [&] (Eolian_Class const* inherit_klass) diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc index 0983406..936687a 100644 --- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc +++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc @@ -292,6 +292,23 @@ EFL_START_TEST(eolian_cxx_test_properties) } EFL_END_TEST +EFL_START_TEST(eolian_cxx_test_parent_extensions) +{ + efl::eolian::eolian_init eolian_init; + efl::eolian::eolian_state eolian_state; + + klass_def cls = init_test_data("generic.eo", "Generic", eolian_state); + + auto parent = cls.parent; + ck_assert(parent.is_engaged()); + ck_assert_str_eq("Object", parent->eolian_name.c_str()); + + ck_assert_int_eq(1, cls.extensions.size()); + auto extension = *cls.extensions.cbegin(); + ck_assert_str_eq("Generic_Interface", extension.eolian_name.c_str()); +} +EFL_END_TEST + void eolian_cxx_test_binding(TCase* tc) { @@ -303,4 +320,5 @@ eolian_cxx_test_binding(TCase* tc) tcase_add_test(tc, eolian_cxx_test_type_generation_optional); tcase_add_test(tc, eolian_cxx_test_type_callback); tcase_add_test(tc, eolian_cxx_test_properties); + tcase_add_test(tc, eolian_cxx_test_parent_extensions); } diff --git a/src/tests/eolian_cxx/generic.c b/src/tests/eolian_cxx/generic.c index f558208..ee3a0c3 100644 --- a/src/tests/eolian_cxx/generic.c +++ b/src/tests/eolian_cxx/generic.c @@ -9,6 +9,7 @@ #define GENERIC_PROTECTED #include "generic.eo.h" +#include "generic_interface.eo.h" #include @@ -138,3 +139,4 @@ static void _generic_beta_method1(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNU { } #include "generic.eo.c" +#include "generic_interface.eo.c" diff --git a/src/tests/eolian_cxx/generic.eo b/src/tests/eolian_cxx/generic.eo index 6282cba..7f367a9 100644 --- a/src/tests/eolian_cxx/generic.eo +++ b/src/tests/eolian_cxx/generic.eo @@ -5,7 +5,7 @@ struct Generic.Event field2: list; } -class Generic extends Efl.Object +class Generic extends Efl.Object implements Generic_Interface { data: Generic_Data; methods { diff --git a/src/tests/eolian_cxx/generic_interface.eo b/src/tests/eolian_cxx/generic_interface.eo new file mode 100644 index 0000000..9f11c1a --- /dev/null +++ b/src/tests/eolian_cxx/generic_interface.eo @@ -0,0 +1,3 @@ +interface Generic_Interface +{ +} diff --git a/src/tests/eolian_cxx/meson.build b/src/tests/eolian_cxx/meson.build index d93fe60..a3a0e57 100644 --- a/src/tests/eolian_cxx/meson.build +++ b/src/tests/eolian_cxx/meson.build @@ -34,6 +34,7 @@ pub_eo_files = [ 'cyclic2.eo', 'docs.eo', 'generic.eo', + 'generic_interface.eo', 'name1_name2_type_generation.eo', 'name_name.eo', 'ns_name.eo',