eolian-cxx: Fixed inheritance feature with callbacks

The addition of callbacks was making the inheritance to fail. Fixed
generation by using the C types, instead of the abstracted callback
types for the wrapper functions.
This commit is contained in:
Felipe Magno de Almeida 2014-07-18 17:57:04 -03:00
parent 9c6c7728c0
commit c1e8918b88
2 changed files with 24 additions and 12 deletions

View File

@ -188,7 +188,7 @@ operator<<(std::ostream& out, inheritance_base_operations_function const& x)
out << tab(2) << "virtual " << reinterpret_type(func.ret) << " "
<< func.name << "("
<< parameters_declaration(func.params) << ")" << endl
<< parameters_c_declaration(func.params) << ")" << endl
<< tab(2) << "{" << endl;
if (!is_void)
{
@ -196,9 +196,12 @@ operator<<(std::ostream& out, inheritance_base_operations_function const& x)
}
out << tab(3)
<< "eo_do_super(static_cast<T*>(this)->_eo_ptr()" << endl
<< tab(4) << ", static_cast<T*>(this)->_eo_class()" << endl
<< tab(4) << ", " << function_call(func)
<< ");" << endl;
<< tab(4) << ", static_cast<T*>(this)->_eo_class()," << endl
<< tab(4) << (!is_void ? "_tmp_ret = " : "")
<< "::" << x._func.impl
<< "(";
parameter_names_enumerate(out, func.params)
<< "));" << endl;
if (!is_void)
{
out << tab(3) << "return _tmp_ret;" << endl;
@ -399,17 +402,12 @@ operator<<(std::ostream& out, inheritance_eo_class_getter const& x)
inline void
eo_inheritance_detail_generator(std::ostream& out, eo_class const& cls)
{
#if 0 // Will be fixed ASAP
out << inheritance_wrappers(cls)
#endif
out
<< "namespace efl { namespace eo { namespace detail {" << endl << endl
#if 0 // Will be fixed ASAP
<< inheritance_base_operations(cls) << endl
<< inheritance_base_operations_size(cls)
<< inheritance_operations_description(cls)
<< inheritance_call_constructors(cls)
#endif
<< inheritance_extension(cls)
<< inheritance_eo_class_getter(cls)
<< "} } }" << endl;

View File

@ -86,6 +86,21 @@ operator<<(std::ostream& out, parameters_types const& x)
return out;
}
inline
std::ostream& parameter_names_enumerate(std::ostream& out
, parameters_container_type const& params)
{
for (auto first = params.begin()
, iterator = first
, last = params.end()
; iterator != last; ++iterator)
{
if(iterator != first) out << ", ";
out << iterator->name;
}
return out;
}
struct
parameters_list
{
@ -160,10 +175,9 @@ operator<<(std::ostream& out, parameters_cxx_list const& x)
{
if (it != first)
out << ", ";
if (type_is_callback((*it).type))
if (type_is_callback((*it).type) && it + 1 != last)
{
out << "std::move(" << (*it).name << ")";
assert(it+1 != last);
out << "std::forward<F>(" << (*it).name << ")";
++it; // skip next.
}
else