summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-12-14 18:52:56 -0200
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-12-14 19:45:44 -0200
commitdd5c23035312f5da3358cb30ec9359e40314e0ad (patch)
tree4712ebda688a6bd43b3ada56e6cd2ecde7014a49
parenta83c3cdba446c42d42b22b314ed6f91351e5234d (diff)
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
-rw-r--r--src/Makefile_Eolian_Cxx.am9
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp12
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_binding.cc18
-rw-r--r--src/tests/eolian_cxx/generic.c2
-rw-r--r--src/tests/eolian_cxx/generic.eo2
-rw-r--r--src/tests/eolian_cxx/generic_interface.eo3
-rw-r--r--src/tests/eolian_cxx/meson.build1
7 files changed, 42 insertions, 5 deletions
diff --git a/src/Makefile_Eolian_Cxx.am b/src/Makefile_Eolian_Cxx.am
index be0cbaf501..9b6c32eb05 100644
--- a/src/Makefile_Eolian_Cxx.am
+++ b/src/Makefile_Eolian_Cxx.am
@@ -110,14 +110,14 @@ endif
110 110
111tests/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 111tests/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
112tests/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 112tests/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
113tests/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 113tests/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
114tests/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 114tests/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
115tests/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 115tests/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
116 116
117tests/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 117tests/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
118 118
119tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-simple.$(OBJEXT): tests/eolian_cxx/simple.eo.c tests/eolian_cxx/simple.eo.h 119tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-simple.$(OBJEXT): tests/eolian_cxx/simple.eo.c tests/eolian_cxx/simple.eo.h
120tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-generic.$(OBJEXT): tests/eolian_cxx/generic.eo.c tests/eolian_cxx/generic.eo.h 120tests/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
121tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-a.$(OBJEXT): tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h 121tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-a.$(OBJEXT): tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h
122tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-b.$(OBJEXT): tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h 122tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-b.$(OBJEXT): tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h
123tests/eolian_cxx/$(TESTS_EOLIAN_CXX_OBJNAME)eolian_cxx_suite-c.$(OBJEXT): tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h 123tests/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 \
138tests/eolian_cxx/generic.eo.h \ 138tests/eolian_cxx/generic.eo.h \
139tests/eolian_cxx/generic.eo.hh \ 139tests/eolian_cxx/generic.eo.hh \
140tests/eolian_cxx/generic.eo.impl.hh \ 140tests/eolian_cxx/generic.eo.impl.hh \
141tests/eolian_cxx/generic_interface.eo.c \
142tests/eolian_cxx/generic_interface.eo.h \
143tests/eolian_cxx/generic_interface.eo.hh \
144tests/eolian_cxx/generic_interface.eo.impl.hh \
141tests/eolian_cxx/a.eo.hh tests/eolian_cxx/a.eo.impl.hh tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h \ 145tests/eolian_cxx/a.eo.hh tests/eolian_cxx/a.eo.impl.hh tests/eolian_cxx/a.eo.c tests/eolian_cxx/a.eo.h \
142tests/eolian_cxx/b.eo.hh tests/eolian_cxx/b.eo.impl.hh tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h \ 146tests/eolian_cxx/b.eo.hh tests/eolian_cxx/b.eo.impl.hh tests/eolian_cxx/b.eo.c tests/eolian_cxx/b.eo.h \
143tests/eolian_cxx/c.eo.hh tests/eolian_cxx/c.eo.impl.hh tests/eolian_cxx/c.eo.c tests/eolian_cxx/c.eo.h \ 147tests/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
198EXTRA_DIST2 += \ 202EXTRA_DIST2 += \
199tests/eolian_cxx/simple.eo \ 203tests/eolian_cxx/simple.eo \
200tests/eolian_cxx/generic.eo \ 204tests/eolian_cxx/generic.eo \
205tests/eolian_cxx/generic_interface.eo \
201tests/eolian_cxx/docs.eo \ 206tests/eolian_cxx/docs.eo \
202tests/eolian_cxx/a.eo \ 207tests/eolian_cxx/a.eo \
203tests/eolian_cxx/b.eo \ 208tests/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 08240b6e28..ce54f35dc1 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
987 class_type type; 987 class_type type;
988 std::vector<event_def> events; 988 std::vector<event_def> events;
989 std::set<klass_name, compare_klass_name_by_name> immediate_inherits; 989 std::set<klass_name, compare_klass_name_by_name> immediate_inherits;
990 eina::optional<klass_name> parent;
991 std::set<klass_name, compare_klass_name_by_name> extensions;
992
990 std::set<part_def> parts; 993 std::set<part_def> parts;
991 Eolian_Unit const* unit; 994 Eolian_Unit const* unit;
992 995
@@ -1108,12 +1111,17 @@ struct klass_def
1108 } catch(std::exception const&) {} 1111 } catch(std::exception const&) {}
1109 } 1112 }
1110 if(::eolian_class_parent_get(klass)) 1113 if(::eolian_class_parent_get(klass))
1111 immediate_inherits.insert({::eolian_class_parent_get(klass), {}}); 1114 {
1115 parent = eina::optional<klass_name>({::eolian_class_parent_get(klass), {}});
1116 immediate_inherits.insert(*parent);
1117 }
1112 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_extensions_get(klass)) 1118 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_extensions_get(klass))
1113 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 1119 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
1114 { 1120 {
1115 Eolian_Class const* inherit = &*inherit_iterator; 1121 Eolian_Class const* inherit = &*inherit_iterator;
1116 immediate_inherits.insert({inherit, {}}); 1122 klass_name extension(inherit, {});
1123 immediate_inherits.insert(extension);
1124 extensions.insert(extension);
1117 } 1125 }
1118 std::function<void(Eolian_Class const*)> inherit_algo = 1126 std::function<void(Eolian_Class const*)> inherit_algo =
1119 [&] (Eolian_Class const* inherit_klass) 1127 [&] (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 09834069c5..936687a288 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)
292} 292}
293EFL_END_TEST 293EFL_END_TEST
294 294
295EFL_START_TEST(eolian_cxx_test_parent_extensions)
296{
297 efl::eolian::eolian_init eolian_init;
298 efl::eolian::eolian_state eolian_state;
299
300 klass_def cls = init_test_data("generic.eo", "Generic", eolian_state);
301
302 auto parent = cls.parent;
303 ck_assert(parent.is_engaged());
304 ck_assert_str_eq("Object", parent->eolian_name.c_str());
305
306 ck_assert_int_eq(1, cls.extensions.size());
307 auto extension = *cls.extensions.cbegin();
308 ck_assert_str_eq("Generic_Interface", extension.eolian_name.c_str());
309}
310EFL_END_TEST
311
295void 312void
296eolian_cxx_test_binding(TCase* tc) 313eolian_cxx_test_binding(TCase* tc)
297{ 314{
@@ -303,4 +320,5 @@ eolian_cxx_test_binding(TCase* tc)
303 tcase_add_test(tc, eolian_cxx_test_type_generation_optional); 320 tcase_add_test(tc, eolian_cxx_test_type_generation_optional);
304 tcase_add_test(tc, eolian_cxx_test_type_callback); 321 tcase_add_test(tc, eolian_cxx_test_type_callback);
305 tcase_add_test(tc, eolian_cxx_test_properties); 322 tcase_add_test(tc, eolian_cxx_test_properties);
323 tcase_add_test(tc, eolian_cxx_test_parent_extensions);
306} 324}
diff --git a/src/tests/eolian_cxx/generic.c b/src/tests/eolian_cxx/generic.c
index f558208d4d..ee3a0c3e87 100644
--- a/src/tests/eolian_cxx/generic.c
+++ b/src/tests/eolian_cxx/generic.c
@@ -9,6 +9,7 @@
9#define GENERIC_PROTECTED 9#define GENERIC_PROTECTED
10 10
11#include "generic.eo.h" 11#include "generic.eo.h"
12#include "generic_interface.eo.h"
12 13
13#include <check.h> 14#include <check.h>
14 15
@@ -138,3 +139,4 @@ static void _generic_beta_method1(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNU
138{ 139{
139} 140}
140#include "generic.eo.c" 141#include "generic.eo.c"
142#include "generic_interface.eo.c"
diff --git a/src/tests/eolian_cxx/generic.eo b/src/tests/eolian_cxx/generic.eo
index 6282cbaa95..7f367a975b 100644
--- a/src/tests/eolian_cxx/generic.eo
+++ b/src/tests/eolian_cxx/generic.eo
@@ -5,7 +5,7 @@ struct Generic.Event
5 field2: list<ptr(int)>; 5 field2: list<ptr(int)>;
6} 6}
7 7
8class Generic extends Efl.Object 8class Generic extends Efl.Object implements Generic_Interface
9{ 9{
10 data: Generic_Data; 10 data: Generic_Data;
11 methods { 11 methods {
diff --git a/src/tests/eolian_cxx/generic_interface.eo b/src/tests/eolian_cxx/generic_interface.eo
new file mode 100644
index 0000000000..9f11c1a73c
--- /dev/null
+++ b/src/tests/eolian_cxx/generic_interface.eo
@@ -0,0 +1,3 @@
1interface Generic_Interface
2{
3}
diff --git a/src/tests/eolian_cxx/meson.build b/src/tests/eolian_cxx/meson.build
index d93fe60c88..a3a0e5707f 100644
--- a/src/tests/eolian_cxx/meson.build
+++ b/src/tests/eolian_cxx/meson.build
@@ -34,6 +34,7 @@ pub_eo_files = [
34 'cyclic2.eo', 34 'cyclic2.eo',
35 'docs.eo', 35 'docs.eo',
36 'generic.eo', 36 'generic.eo',
37 'generic_interface.eo',
37 'name1_name2_type_generation.eo', 38 'name1_name2_type_generation.eo',
38 'name_name.eo', 39 'name_name.eo',
39 'ns_name.eo', 40 'ns_name.eo',