summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2018-11-22 16:21:52 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2018-11-23 13:57:07 +0100
commit14ce54c30321e3b78b979872427b07d9420d5c66 (patch)
treef5947b26e04a7a162434d9ca250b0cb145bfab03 /src/lib/eolian_cxx
parentf3eb8d6441af396e61842cb83b9ac7b3af34f527 (diff)
eolian: implement new inherit behavior
Eolian now separates 'parent' and 'extensions'. For regular classes, parent is the first item in the inherits list and extesions is the rest. For interfaces and mixins, parent is NULL and extends is the inherits list. The reason for this is the separation of them in syntax in near future. It also slightly changes the behavior; since for interfaces and mixins, parent is always NULL now, you can freely inherit from all types of classes without needing to manually put an interface type as the first item of the inherits list.
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 48044d9be7..5a4a753a61 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -1036,7 +1036,9 @@ struct klass_def
1036 functions.push_back({function, EOLIAN_METHOD, NULL, unit}); 1036 functions.push_back({function, EOLIAN_METHOD, NULL, unit});
1037 } catch(std::exception const&) {} 1037 } catch(std::exception const&) {}
1038 } 1038 }
1039 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(klass)) 1039 if(::eolian_class_parent_get(klass))
1040 immediate_inherits.insert({::eolian_class_parent_get(klass), {}});
1041 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_extensions_get(klass))
1040 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 1042 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
1041 { 1043 {
1042 Eolian_Class const* inherit = &*inherit_iterator; 1044 Eolian_Class const* inherit = &*inherit_iterator;
@@ -1045,7 +1047,13 @@ struct klass_def
1045 std::function<void(Eolian_Class const*)> inherit_algo = 1047 std::function<void(Eolian_Class const*)> inherit_algo =
1046 [&] (Eolian_Class const* inherit_klass) 1048 [&] (Eolian_Class const* inherit_klass)
1047 { 1049 {
1048 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(inherit_klass)) 1050 if(::eolian_class_parent_get(inherit_klass))
1051 {
1052 Eolian_Class const* inherit = ::eolian_class_parent_get(inherit_klass);
1053 inherits.insert({inherit, {}});
1054 inherit_algo(inherit);
1055 }
1056 for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_extensions_get(inherit_klass))
1049 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 1057 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
1050 { 1058 {
1051 Eolian_Class const* inherit = &*inherit_iterator; 1059 Eolian_Class const* inherit = &*inherit_iterator;