From b3bd72cd114f8537eed6707810f9cda498c00726 Mon Sep 17 00:00:00 2001 From: Savio Sena Date: Mon, 21 Jul 2014 22:13:54 -0300 Subject: [PATCH] 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. --- src/bin/eolian_cxx/convert.cc | 3 ++- src/bin/eolian_cxx/eolian_wrappers.hh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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) // if the getter has a single parameter and a void return // it is transformed into a getter with no parameters // that actually returns what would be the first argument. - if (params.size() == 1 && efl::eolian::type_is_void(ret)) + if (params.size() == 1 && efl::eolian::type_is_void(ret) && + !function_return_is_explicit_void(*prop_, eolian_cxx::getter)) { get_.ret = params[0].type; 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 @@ -207,6 +207,16 @@ function_return_type(Eolian_Function const& func, ctor_t func_type) return function_return_type(func, func_type.value); } +inline bool +function_return_is_explicit_void(Eolian_Function const& func, getter_t func_type) +{ + // XXX This function shouldn't be necessary. Eolian database should + // forge functions as desired and the bindings generator shouldn't + // be required to convert and understand this. + Eolian_Type const* type = ::eolian_function_return_type_get(&func, func_type.value); + return !!type && safe_str(type->name) == "void"; +} + inline bool property_is_getter(Eolian_Function_Type func_type) {