summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/eolian/sources.c5
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc4
-rw-r--r--src/bindings/luajit/eolian.lua2
-rw-r--r--src/lib/eolian/Eolian.h2
-rw-r--r--src/lib/eolian/database_class.c3
-rw-r--r--src/lib/eolian/database_validate.c6
-rw-r--r--src/lib/eolian/eo_parser.c10
-rw-r--r--src/lib/eolian/eolian_database.h2
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp4
-rw-r--r--src/scripts/elua/apps/docgen/doctree.lua4
-rw-r--r--src/scripts/elua/modules/lualian.lua3
-rw-r--r--src/tests/eolian/eolian_parsing.c17
12 files changed, 27 insertions, 35 deletions
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index 473342a..2ba900c 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -965,14 +965,13 @@ eo_gen_source_gen(const Eolian_Unit *src,
965 965
966 /* inherits in EFL_DEFINE_CLASS */ 966 /* inherits in EFL_DEFINE_CLASS */
967 { 967 {
968 const char *iname; 968 const Eolian_Class *icl;
969 Eina_Iterator *itr = eolian_class_inherits_get(cl); 969 Eina_Iterator *itr = eolian_class_inherits_get(cl);
970 /* no inherits, NULL parent */ 970 /* no inherits, NULL parent */
971 if (!itr) 971 if (!itr)
972 eina_strbuf_append(buf, ", NULL"); 972 eina_strbuf_append(buf, ", NULL");
973 EINA_ITERATOR_FOREACH(itr, iname) 973 EINA_ITERATOR_FOREACH(itr, icl)
974 { 974 {
975 const Eolian_Class *icl = eolian_class_get_by_name(src, iname);
976 Eina_Stringshare *mname = eolian_class_c_name_get(icl); 975 Eina_Stringshare *mname = eolian_class_c_name_get(icl);
977 eina_strbuf_append_printf(buf, ", %s", mname); 976 eina_strbuf_append_printf(buf, ", %s", mname);
978 eina_stringshare_del(mname); 977 eina_stringshare_del(mname);
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index c98412a..34b8bbc 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -114,10 +114,10 @@ generate(const Eolian_Class* klass, eolian_cxx::options_type const& opts)
114 std::function<void(Eolian_Class const*)> klass_function 114 std::function<void(Eolian_Class const*)> klass_function
115 = [&] (Eolian_Class const* klass) 115 = [&] (Eolian_Class const* klass)
116 { 116 {
117 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass)) 117 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(klass))
118 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 118 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
119 { 119 {
120 Eolian_Class const* inherit = ::eolian_class_get_by_name(opts.unit, &*inherit_iterator); 120 Eolian_Class const* inherit = &*inherit_iterator;
121 c_headers.insert(eolian_class_file_get(inherit) + std::string(".h")); 121 c_headers.insert(eolian_class_file_get(inherit) + std::string(".h"));
122 cpp_headers.insert(eolian_class_file_get(inherit) + std::string(".hh")); 122 cpp_headers.insert(eolian_class_file_get(inherit) + std::string(".hh"));
123 efl::eolian::grammar::attributes::klass_def klass{inherit, opts.unit}; 123 efl::eolian::grammar::attributes::klass_def klass{inherit, opts.unit};
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 8982ef4..b0c0f7c 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -1239,7 +1239,7 @@ M.Class = ffi.metatype("Eolian_Class", {
1239 end, 1239 end,
1240 1240
1241 inherits_get = function(self) 1241 inherits_get = function(self)
1242 return iterator.String_Iterator( 1242 return Ptr_Iterator("const Eolian_Class*",
1243 eolian.eolian_class_inherits_get(self)) 1243 eolian.eolian_class_inherits_get(self))
1244 end, 1244 end,
1245 1245
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index bc8bbb4..b69f2c5 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -709,7 +709,7 @@ EAPI Eina_Stringshare* eolian_class_event_prefix_get(const Eolian_Class *klass);
709EAPI Eina_Stringshare *eolian_class_data_type_get(const Eolian_Class *klass); 709EAPI Eina_Stringshare *eolian_class_data_type_get(const Eolian_Class *klass);
710 710
711/* 711/*
712 * @brief Returns an iterator to the names of inherit classes of a class 712 * @brief Returns an iterator to the inherited classes.
713 * 713 *
714 * @param[in] klass the class 714 * @param[in] klass the class
715 * @return the iterator 715 * @return the iterator
diff --git a/src/lib/eolian/database_class.c b/src/lib/eolian/database_class.c
index f3faa9b..fc56325 100644
--- a/src/lib/eolian/database_class.c
+++ b/src/lib/eolian/database_class.c
@@ -18,9 +18,6 @@ database_class_del(Eolian_Class *cl)
18 18
19 if (cl->base.file) eina_stringshare_del(cl->base.file); 19 if (cl->base.file) eina_stringshare_del(cl->base.file);
20 20
21 EINA_LIST_FREE(cl->inherits, s)
22 if (s) eina_stringshare_del(s);
23
24 EINA_LIST_FREE(cl->implements, impl) 21 EINA_LIST_FREE(cl->implements, impl)
25 database_implement_del(impl); 22 database_implement_del(impl);
26 23
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 0b1dd0e..28ffd5f 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -373,7 +373,7 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash)
373 Eolian_Function *func; 373 Eolian_Function *func;
374 Eolian_Event *event; 374 Eolian_Event *event;
375 Eolian_Implement *impl; 375 Eolian_Implement *impl;
376 const char *iname; 376 Eolian_Class *icl;
377 Eina_Bool res = EINA_TRUE; 377 Eina_Bool res = EINA_TRUE;
378 378
379 if (!cl) 379 if (!cl)
@@ -386,9 +386,9 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash)
386 if (ahash) 386 if (ahash)
387 nhash = eina_hash_string_small_new(NULL); 387 nhash = eina_hash_string_small_new(NULL);
388 388
389 EINA_LIST_FOREACH(cl->inherits, l, iname) 389 EINA_LIST_FOREACH(cl->inherits, l, icl)
390 { 390 {
391 if (!(res = _validate_class(eina_hash_find(_classes, iname), nhash))) 391 if (!(res = _validate_class(icl, nhash)))
392 goto freehash; 392 goto freehash;
393 } 393 }
394 394
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index a7649e0..e6d8b6b 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -2021,8 +2021,7 @@ _inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf, Eina_Bool check_inherit,
2021 default: 2021 default:
2022 break; 2022 break;
2023 } 2023 }
2024 ls->tmp.kls->inherits = eina_list_append(ls->tmp.kls->inherits, 2024 ls->tmp.kls->inherits = eina_list_append(ls->tmp.kls->inherits, dep);
2025 eina_stringshare_add(iname));
2026 dep->toplevel = EINA_FALSE; 2025 dep->toplevel = EINA_FALSE;
2027 eo_lexer_context_pop(ls); 2026 eo_lexer_context_pop(ls);
2028} 2027}
@@ -2245,14 +2244,13 @@ _get_impl_class(const Eolian_Class *cl, const char *cln)
2245 if (!cl || !strcmp(cl->full_name, cln)) 2244 if (!cl || !strcmp(cl->full_name, cln))
2246 return cl; 2245 return cl;
2247 Eina_List *l; 2246 Eina_List *l;
2248 const char *s; 2247 Eolian_Class *icl;
2249 EINA_LIST_FOREACH(cl->inherits, l, s) 2248 EINA_LIST_FOREACH(cl->inherits, l, icl)
2250 { 2249 {
2251 /* we can do a depth first search, it's easier and doesn't matter 2250 /* we can do a depth first search, it's easier and doesn't matter
2252 * which part of the inheritance tree we find the class in 2251 * which part of the inheritance tree we find the class in
2253 */ 2252 */
2254 /* FIXME: pass unit properly */ 2253 const Eolian_Class *fcl = _get_impl_class(icl, cln);
2255 const Eolian_Class *fcl = _get_impl_class(eolian_class_get_by_name(NULL, s), cln);
2256 if (fcl) 2254 if (fcl)
2257 return fcl; 2255 return fcl;
2258 } 2256 }
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index c99a474..ae53ff9 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -91,7 +91,7 @@ struct _Eolian_Class
91 Eina_Stringshare *eo_prefix; 91 Eina_Stringshare *eo_prefix;
92 Eina_Stringshare *ev_prefix; 92 Eina_Stringshare *ev_prefix;
93 Eina_Stringshare *data_type; 93 Eina_Stringshare *data_type;
94 Eina_List *inherits; /* List Eina_Stringshare * */ 94 Eina_List *inherits; /* List Eolian_Class * */
95 Eina_List *properties; /* List prop_name -> Eolian_Function */ 95 Eina_List *properties; /* List prop_name -> Eolian_Function */
96 Eina_List *methods; /* List meth_name -> Eolian_Function */ 96 Eina_List *methods; /* List meth_name -> Eolian_Function */
97 Eina_List *implements; /* List implements name -> Eolian_Implement */ 97 Eina_List *implements; /* List implements name -> Eolian_Implement */
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 3de453e..146bfbe 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -687,10 +687,10 @@ struct klass_def
687 std::function<void(Eolian_Class const*)> inherit_algo = 687 std::function<void(Eolian_Class const*)> inherit_algo =
688 [&] (Eolian_Class const* klass) 688 [&] (Eolian_Class const* klass)
689 { 689 {
690 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass)) 690 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(klass))
691 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 691 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
692 { 692 {
693 Eolian_Class const* inherit = ::eolian_class_get_by_name(unit, &*inherit_iterator); 693 Eolian_Class const* inherit = &*inherit_iterator;
694 inherits.insert({inherit, {}}); 694 inherits.insert({inherit, {}});
695 inherit_algo(inherit); 695 inherit_algo(inherit);
696 } 696 }
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua
index 146479f..f4f55af 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -223,9 +223,7 @@ M.Class = Node:clone {
223 return ret 223 return ret
224 end 224 end
225 ret = {} 225 ret = {}
226 for cln in self.class:inherits_get() do 226 for cl in self.class:inherits_get() do
227 local cl = self.by_name_get(cln)
228 assert(cl)
229 ret[#ret + 1] = cl 227 ret[#ret + 1] = cl
230 end 228 end
231 self._cache_inhc = ret 229 self._cache_inhc = ret
diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua
index 1253252..035c24d 100644
--- a/src/scripts/elua/modules/lualian.lua
+++ b/src/scripts/elua/modules/lualian.lua
@@ -670,8 +670,7 @@ local gen_class = function(klass)
670 local parents = {} 670 local parents = {}
671 local mixins = {} -- also includes ifaces, they're separated later 671 local mixins = {} -- also includes ifaces, they're separated later
672 for i = 1, #inherits do 672 for i = 1, #inherits do
673 local v = inherits[i] 673 local tp = inherits[i]:type_get()
674 local tp = eolian.class_get_by_name(gen_unit, v):type_get()
675 if tp == class_type.REGULAR or tp == class_type.ABSTRACT then 674 if tp == class_type.REGULAR or tp == class_type.ABSTRACT then
676 parents[#parents + 1] = v 675 parents[#parents + 1] = v
677 elseif tp == class_type.INTERFACE or tp == class_type.MIXIN then 676 elseif tp == class_type.INTERFACE or tp == class_type.MIXIN then
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 86c0798..c9d07ba 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -12,11 +12,12 @@
12 12
13START_TEST(eolian_namespaces) 13START_TEST(eolian_namespaces)
14{ 14{
15 const Eolian_Class *class11, *class112, *class21, *class_no, *impl_class; 15 const Eolian_Class *class11, *class112, *class21, *class_no, *impl_class,
16 *iclass;
16 const Eolian_Function *fid; 17 const Eolian_Function *fid;
17 Eina_Iterator *iter; 18 Eina_Iterator *iter;
18 Eolian_Function_Type func_type; 19 Eolian_Function_Type func_type;
19 const char *class_name, *val1, *val2; 20 const char *val1, *val2;
20 const Eolian_Implement *impl; 21 const Eolian_Implement *impl;
21 const Eolian_Unit *unit; 22 const Eolian_Unit *unit;
22 void *dummy; 23 void *dummy;
@@ -61,12 +62,12 @@ START_TEST(eolian_namespaces)
61 62
62 /* Inherits */ 63 /* Inherits */
63 fail_if(!(iter = eolian_class_inherits_get(class11))); 64 fail_if(!(iter = eolian_class_inherits_get(class11)));
64 fail_if(!(eina_iterator_next(iter, (void**)&class_name))); 65 fail_if(!(eina_iterator_next(iter, (void**)&iclass)));
65 fail_if(eolian_class_get_by_name(unit, class_name) != class112); 66 fail_if(iclass != class112);
66 fail_if(!(eina_iterator_next(iter, (void**)&class_name))); 67 fail_if(!(eina_iterator_next(iter, (void**)&iclass)));
67 fail_if(eolian_class_get_by_name(unit, class_name) != class21); 68 fail_if(iclass != class21);
68 fail_if(!(eina_iterator_next(iter, (void**)&class_name))); 69 fail_if(!(eina_iterator_next(iter, (void**)&iclass)));
69 fail_if(eolian_class_get_by_name(unit, class_name) != class_no); 70 fail_if(iclass != class_no);
70 fail_if(eina_iterator_next(iter, &dummy)); 71 fail_if(eina_iterator_next(iter, &dummy));
71 eina_iterator_free(iter); 72 eina_iterator_free(iter);
72 73