csharp: Fixes repeated method names.

Summary:
After D8397, interfaces have the I prefix again, so the "Do" prefix on
methods with repeated names may not be needed for them in most cases.

This commit also consolidates the method_managed_name calls with the
overload receiving attributes::function_def instead of plain name.

Fixes T7791

Depends on D8645

Reviewers: vitor.sousa, felipealmeida, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7791

Differential Revision: https://phab.enlightenment.org/D8650
This commit is contained in:
Lauro Moura 2019-04-23 12:19:09 +02:00 committed by Xavi Artigas
parent 68fe9ec6bf
commit cb0c20eaf3
2 changed files with 8 additions and 14 deletions

View File

@ -74,8 +74,7 @@ struct documentation_generator
if (blacklist::is_function_blacklisted(
::eolian_function_full_c_name_get(function, ftype))) return "";
name += ".";
name += name_helpers::managed_method_name(
::eolian_object_short_name_get(klass), eo_name);
name += name_helpers::managed_method_name({function, ftype, NULL, eolian_object_unit_get(EOLIAN_OBJECT(function))});
break;
case ::EOLIAN_PROP_SET:
name += ".Set";
@ -118,7 +117,7 @@ struct documentation_generator
case attributes::function_type::prop_get:
if (blacklist::is_function_blacklisted(func.c_name))return "";
if (!name.empty()) name += ".";
name += name_helpers::managed_method_name(func.klass.eolian_name, func.name);
name += name_helpers::managed_method_name(func);
break;
default:
// No need to deal with property as function_defs are converted to get/set when building a given klass_def.
@ -432,7 +431,7 @@ struct documentation_generator
return generate_all_tag_examples(sink,
name_helpers::klass_full_concrete_or_interface_name(func.klass),
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
name_helpers::managed_method_name(func),
context);
}
@ -451,7 +450,7 @@ struct documentation_generator
return generate_all_tag_examples(sink,
name_helpers::klass_full_concrete_or_interface_name(func.klass),
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
name_helpers::managed_method_name(func),
context);
}

View File

@ -176,22 +176,22 @@ inline std::string managed_namespace(std::string const& ns)
return escape_keyword(utils::remove_all(ns, '_'));
}
inline std::string managed_method_name(std::string const& klass, std::string const& name)
inline std::string managed_method_name(attributes::function_def const& f)
{
std::vector<std::string> names = utils::split(name, '_');
std::vector<std::string> names = utils::split(f.name, '_');
name_helpers::reorder_verb(names);
std::string candidate = escape_keyword(utils::to_pascal_case(names));
// Some eolian methods have the same name as their parent class
if (candidate == klass)
if (candidate == klass_concrete_or_interface_name(f.klass))
candidate = "Do" + candidate;
// Avoid clashing with System.Object.GetType
if (candidate == "GetType" || candidate == "SetType")
{
candidate.insert(3, klass);
candidate.insert(3, f.klass.eolian_name);
}
return candidate;
@ -203,11 +203,6 @@ inline std::string managed_name(std::string const& name, char separator='_')
return utils::to_pascal_case(tokens);
}
inline std::string managed_method_name(attributes::function_def const& f)
{
return managed_method_name(f.klass.eolian_name, f.name);
}
inline std::string alias_full_eolian_name(attributes::alias_def const& alias)
{