summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-07-21 22:13:54 -0300
committerSavio Sena <savio@expertisesolutions.com.br>2014-07-21 22:13:54 -0300
commitb3bd72cd114f8537eed6707810f9cda498c00726 (patch)
treea7dd0da1faad53892b7cbdc63c215b390e5fca35 /src
parentf6c32ddffcdcad62936d16d75015cfdf75686201 (diff)
eolian-cxx: Handle exclicitly void-return getters.
Whenever a getter explicitly defines a void return the generated code shall not convert single-parameter getters in any ways. Actually the correct approach would be to delegate all conversions to Eolian Database instead of for the generators.
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian_cxx/convert.cc3
-rw-r--r--src/bin/eolian_cxx/eolian_wrappers.hh10
2 files changed, 12 insertions, 1 deletions
diff --git a/src/bin/eolian_cxx/convert.cc b/src/bin/eolian_cxx/convert.cc
index 71311886be..5597725cd3 100644
--- a/src/bin/eolian_cxx/convert.cc
+++ b/src/bin/eolian_cxx/convert.cc
@@ -101,7 +101,8 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
101 // if the getter has a single parameter and a void return 101 // if the getter has a single parameter and a void return
102 // it is transformed into a getter with no parameters 102 // it is transformed into a getter with no parameters
103 // that actually returns what would be the first argument. 103 // that actually returns what would be the first argument.
104 if (params.size() == 1 && efl::eolian::type_is_void(ret)) 104 if (params.size() == 1 && efl::eolian::type_is_void(ret) &&
105 !function_return_is_explicit_void(*prop_, eolian_cxx::getter))
105 { 106 {
106 get_.ret = params[0].type; 107 get_.ret = params[0].type;
107 get_.params.clear(); 108 get_.params.clear();
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh b/src/bin/eolian_cxx/eolian_wrappers.hh
index 0d1fc39114..f956650c8d 100644
--- a/src/bin/eolian_cxx/eolian_wrappers.hh
+++ b/src/bin/eolian_cxx/eolian_wrappers.hh
@@ -208,6 +208,16 @@ function_return_type(Eolian_Function const& func, ctor_t func_type)
208} 208}
209 209
210inline bool 210inline bool
211function_return_is_explicit_void(Eolian_Function const& func, getter_t func_type)
212{
213 // XXX This function shouldn't be necessary. Eolian database should
214 // forge functions as desired and the bindings generator shouldn't
215 // be required to convert and understand this.
216 Eolian_Type const* type = ::eolian_function_return_type_get(&func, func_type.value);
217 return !!type && safe_str(type->name) == "void";
218}
219
220inline bool
211property_is_getter(Eolian_Function_Type func_type) 221property_is_getter(Eolian_Function_Type func_type)
212{ 222{
213 return func_type == property_t::value || func_type == getter_t::value; 223 return func_type == property_t::value || func_type == getter_t::value;