forked from enlightenment/efl
csharp: Fix managed name when solving Get/SetType name clash
Summary: If you declare a property called "type", the generated getter method would be called "GetType", clashing with "System.Object.GetType" method. The current workaround for that is to straight-forwardly insert the respective class/abstract's Eolian name into the function name (becoming, for example "GetMy_ClassType"), sometimes getting inconsistent to not only other methods but also with documentation (leading to XML errors, since a cref doc would reference "GetMyClassType", which doesn't exists). This patch fixes that by wrapping the Eolian name with the already existing `managed_name` function. Test Plan: Run ninja tests. Reviewers: zmike, segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11331
This commit is contained in:
parent
cc777c05f8
commit
9510702ede
|
@ -229,6 +229,12 @@ inline std::string managed_namespace(std::string const& ns)
|
|||
return escape_keyword(utils::remove_all(ns, '_'));
|
||||
}
|
||||
|
||||
inline std::string managed_name(std::string const& name, char separator='_')
|
||||
{
|
||||
auto tokens = utils::split(name, separator);
|
||||
return utils::to_pascal_case(tokens);
|
||||
}
|
||||
|
||||
inline std::string managed_method_name(attributes::function_def const& f)
|
||||
{
|
||||
std::vector<std::string> names = utils::split(f.name, '_');
|
||||
|
@ -244,18 +250,12 @@ inline std::string managed_method_name(attributes::function_def const& f)
|
|||
// Avoid clashing with System.Object.GetType
|
||||
if (candidate == "GetType" || candidate == "SetType")
|
||||
{
|
||||
candidate.insert(3, f.klass.eolian_name);
|
||||
candidate.insert(3, managed_name(f.klass.eolian_name));
|
||||
}
|
||||
|
||||
return candidate;
|
||||
}
|
||||
|
||||
inline std::string managed_name(std::string const& name, char separator='_')
|
||||
{
|
||||
auto tokens = utils::split(name, separator);
|
||||
return utils::to_pascal_case(tokens);
|
||||
}
|
||||
|
||||
inline std::string full_managed_name(std::string const& name)
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
|
Loading…
Reference in New Issue