xartigas pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9510702ede61e95e8d5e2776f8178c742ece3d04

commit 9510702ede61e95e8d5e2776f8178c742ece3d04
Author: João Paulo Taylor Ienczak Zanette <[email protected]>
Date:   Wed Feb 12 16:39:51 2020 +0100

    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
---
 src/bin/eolian_mono/eolian/mono/name_helpers.hh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh 
b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index a6e94ea2f6..1294bf01ed 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -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;

-- 


Reply via email to