summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-01 09:37:50 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-01 10:39:01 -0700
commit473d5b79c51f19f7949eea8030edc8180826e055 (patch)
treefad272978833f5ecd91dd54e9e235d3c3f73432e /src/lib/eolian_cxx
parente43d72710bb4c8f588b8a262f1a1a2040ec7ad78 (diff)
efl_cxx: remove eolized promises from the CXX bindings
Summary: Also added a blacklist header to temporarily disable generation of eo methods with futures as arguments or return type. Once the models branch lands, we should enable future support again with eina_futures. Reviewers: cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D6018
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/blacklist.hpp54
-rw-r--r--src/lib/eolian_cxx/grammar/function_declaration.hpp4
-rw-r--r--src/lib/eolian_cxx/grammar/function_definition.hpp4
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp12
4 files changed, 68 insertions, 6 deletions
diff --git a/src/lib/eolian_cxx/grammar/blacklist.hpp b/src/lib/eolian_cxx/grammar/blacklist.hpp
new file mode 100644
index 0000000000..21332b6f73
--- /dev/null
+++ b/src/lib/eolian_cxx/grammar/blacklist.hpp
@@ -0,0 +1,54 @@
1#ifndef EOLIAN_CXX_BLACKLIST_HH
2#define EOLIAN_CXX_BLACKLIST_HH
3
4#include <algorithm>
5#include "grammar/klass_def.hpp"
6
7namespace efl { namespace eolian { namespace grammar {
8
9namespace blacklist {
10
11bool is_blacklisted(attributes::type_def const& t);
12
13struct type_blacklisted_visitor
14{
15 typedef type_blacklisted_visitor visitor_type;
16 typedef bool result_type;
17
18 bool operator()(attributes::regular_type_def const&) const
19 {
20 return false;
21 }
22 bool operator()(attributes::klass_name const&) const
23 {
24 return false;
25 }
26 bool operator()(attributes::complex_type_def const& c) const
27 {
28 if (c.outer.base_type == "future")
29 return true;
30
31 return std::any_of(c.subtypes.begin(), c.subtypes.end(), is_blacklisted);
32 }
33};
34
35bool is_blacklisted(attributes::type_def const& t)
36{
37 return t.original_type.visit(type_blacklisted_visitor{});
38}
39
40bool is_blacklisted(attributes::function_def const& f)
41{
42 if (is_blacklisted(f.return_type))
43 return true;
44
45 return std::any_of(f.parameters.cbegin(), f.parameters.cend(), [](attributes::parameter_def const& p) { return is_blacklisted(p.type); });
46}
47
48
49} // namespace grammar
50} } } // namespace efl / eolian / grammar
51
52
53
54#endif
diff --git a/src/lib/eolian_cxx/grammar/function_declaration.hpp b/src/lib/eolian_cxx/grammar/function_declaration.hpp
index f30f7569dc..dc6a969a58 100644
--- a/src/lib/eolian_cxx/grammar/function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/function_declaration.hpp
@@ -12,6 +12,7 @@
12#include "grammar/type.hpp" 12#include "grammar/type.hpp"
13#include "grammar/parameter.hpp" 13#include "grammar/parameter.hpp"
14#include "grammar/keyword.hpp" 14#include "grammar/keyword.hpp"
15#include "grammar/blacklist.hpp"
15 16
16namespace efl { namespace eolian { namespace grammar { 17namespace efl { namespace eolian { namespace grammar {
17 18
@@ -24,6 +25,9 @@ struct function_declaration_generator
24 template <typename OutputIterator, typename Context> 25 template <typename OutputIterator, typename Context>
25 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const 26 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const
26 { 27 {
28 if (blacklist::is_blacklisted(f))
29 return true;
30
27 std::string suffix, static_flag, const_flag; 31 std::string suffix, static_flag, const_flag;
28 switch(_klass_name.type) 32 switch(_klass_name.type)
29 { 33 {
diff --git a/src/lib/eolian_cxx/grammar/function_definition.hpp b/src/lib/eolian_cxx/grammar/function_definition.hpp
index 9b646efc9c..b3080e4c67 100644
--- a/src/lib/eolian_cxx/grammar/function_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/function_definition.hpp
@@ -18,6 +18,7 @@
18#include "grammar/attribute_reorder.hpp" 18#include "grammar/attribute_reorder.hpp"
19#include "grammar/type_impl.hpp" 19#include "grammar/type_impl.hpp"
20#include "grammar/eps.hpp" 20#include "grammar/eps.hpp"
21#include "grammar/blacklist.hpp"
21 22
22namespace efl { namespace eolian { namespace grammar { 23namespace efl { namespace eolian { namespace grammar {
23 24
@@ -30,6 +31,9 @@ struct function_definition_generator
30 template <typename OutputIterator, typename Context> 31 template <typename OutputIterator, typename Context>
31 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const 32 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& ctx) const
32 { 33 {
34 if (blacklist::is_blacklisted(f))
35 return true;
36
33 std::string suffix; 37 std::string suffix;
34 switch(_klass_name.type) 38 switch(_klass_name.type)
35 { 39 {
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index ebe738abed..21f59c01da 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -311,12 +311,12 @@ struct visitor_generate
311 (complex, regular_type_def{" ::efl::promise", complex.outer.base_qualifier, {}}); 311 (complex, regular_type_def{" ::efl::promise", complex.outer.base_qualifier, {}});
312 } 312 }
313 } 313 }
314 , {"future", nullptr, nullptr, [&] 314 /* , {"future", nullptr, nullptr, [&] */
315 { 315 /* { */
316 return replace_outer 316 /* return replace_outer */
317 (complex, regular_type_def{" ::efl::shared_future", complex.outer.base_qualifier, {}}); 317 /* (complex, regular_type_def{" ::efl::shared_future", complex.outer.base_qualifier, {}}); */
318 } 318 /* } */
319 } 319 /* } */
320 , {"iterator", nullptr, nullptr, [&] 320 , {"iterator", nullptr, nullptr, [&]
321 { 321 {
322 return replace_outer 322 return replace_outer