efl-csharp: Remove spaces from type strings in generator.

Summary:
Previously, the type_impl and marshall_type_impl generators relied on a
type mismatch in the match table to fallback to the else branch in the
match check to actually print the type string. This was achieved by
adding the " " prefix to the type.

This commit changes this behavior to invoke a proper visitor just to
print and makes both generators return trimmed type strings.

This will help conforming to the C# coding conventions.

Test Plan: run test suite

Reviewers: felipealmeida, vitor.sousa

Reviewed By: felipealmeida, vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8441
This commit is contained in:
Lauro Moura 2019-03-26 14:45:18 -03:00 committed by Vitor Sousa
parent 40f50d1e61
commit a4ae92d8dd
4 changed files with 98 additions and 77 deletions

View File

@ -161,7 +161,7 @@ struct marshall_type_visitor_generate
} }
, [&] (attributes::type_def::variant_type const& v) , [&] (attributes::type_def::variant_type const& v)
{ {
return v.visit(*this); // we want to keep is_out info return v.visit(visitor_regular_type_def_printer<OutputIterator, Context>{sink, context}); // we want to keep is_out info
})) }))
{ {
return *b; return *b;

View File

@ -68,6 +68,27 @@ eina::optional<bool> call_match(Array const (&array)[N], F f, A a)
return {nullptr}; return {nullptr};
} }
template <typename OutputIterator, typename Context>
struct visitor_regular_type_def_printer
{
typedef visitor_regular_type_def_printer visitor_type;
typedef bool result_type;
mutable OutputIterator sink;
Context const* context;
bool operator()(grammar::attributes::regular_type_def const &regular) const
{
return as_generator(string).generate(sink, name_helpers::type_full_managed_name(regular), *context);
}
template<typename T>
bool operator()(T const&) const
{
return true;
}
};
template <typename OutputIterator, typename Context> template <typename OutputIterator, typename Context>
struct visitor_generate struct visitor_generate
{ {
@ -234,7 +255,7 @@ struct visitor_generate
} }
, [&] (attributes::type_def::variant_type const& v) , [&] (attributes::type_def::variant_type const& v)
{ {
return v.visit(*this); // we want to keep is_out info return v.visit(visitor_regular_type_def_printer<OutputIterator, Context>{sink, context}); // we want to keep is_out info
})) }))
{ {
return *b; return *b;