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.
This commit is contained in:
Savio Sena 2014-07-21 22:13:54 -03:00
parent f6c32ddffc
commit b3bd72cd11
2 changed files with 12 additions and 1 deletions

View File

@ -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();

View File

@ -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)
{