summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-23 12:19:09 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-04-23 12:31:37 +0200
commitcb0c20eaf3ba89ab850af5b813e6ddfb6cc4a15a (patch)
tree4e963ab0c3dc1c8db65a9725f6a8abccda45a9f3 /src/bin
parent68fe9ec6bf60b4730ad7fdbf2698dc7aa130b94d (diff)
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/documentation.hh9
-rw-r--r--src/bin/eolian_mono/eolian/mono/name_helpers.hh13
2 files changed, 8 insertions, 14 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh
index 2cad038e25..ac072a4220 100644
--- a/src/bin/eolian_mono/eolian/mono/documentation.hh
+++ b/src/bin/eolian_mono/eolian/mono/documentation.hh
@@ -74,8 +74,7 @@ struct documentation_generator
74 if (blacklist::is_function_blacklisted( 74 if (blacklist::is_function_blacklisted(
75 ::eolian_function_full_c_name_get(function, ftype))) return ""; 75 ::eolian_function_full_c_name_get(function, ftype))) return "";
76 name += "."; 76 name += ".";
77 name += name_helpers::managed_method_name( 77 name += name_helpers::managed_method_name({function, ftype, NULL, eolian_object_unit_get(EOLIAN_OBJECT(function))});
78 ::eolian_object_short_name_get(klass), eo_name);
79 break; 78 break;
80 case ::EOLIAN_PROP_SET: 79 case ::EOLIAN_PROP_SET:
81 name += ".Set"; 80 name += ".Set";
@@ -118,7 +117,7 @@ struct documentation_generator
118 case attributes::function_type::prop_get: 117 case attributes::function_type::prop_get:
119 if (blacklist::is_function_blacklisted(func.c_name))return ""; 118 if (blacklist::is_function_blacklisted(func.c_name))return "";
120 if (!name.empty()) name += "."; 119 if (!name.empty()) name += ".";
121 name += name_helpers::managed_method_name(func.klass.eolian_name, func.name); 120 name += name_helpers::managed_method_name(func);
122 break; 121 break;
123 default: 122 default:
124 // No need to deal with property as function_defs are converted to get/set when building a given klass_def. 123 // 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
432 431
433 return generate_all_tag_examples(sink, 432 return generate_all_tag_examples(sink,
434 name_helpers::klass_full_concrete_or_interface_name(func.klass), 433 name_helpers::klass_full_concrete_or_interface_name(func.klass),
435 name_helpers::managed_method_name(func.klass.eolian_name, func.name), 434 name_helpers::managed_method_name(func),
436 context); 435 context);
437 } 436 }
438 437
@@ -451,7 +450,7 @@ struct documentation_generator
451 450
452 return generate_all_tag_examples(sink, 451 return generate_all_tag_examples(sink,
453 name_helpers::klass_full_concrete_or_interface_name(func.klass), 452 name_helpers::klass_full_concrete_or_interface_name(func.klass),
454 name_helpers::managed_method_name(func.klass.eolian_name, func.name), 453 name_helpers::managed_method_name(func),
455 context); 454 context);
456 } 455 }
457 456
diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index 4d9fff92de..1ae35cab6d 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -176,22 +176,22 @@ inline std::string managed_namespace(std::string const& ns)
176 return escape_keyword(utils::remove_all(ns, '_')); 176 return escape_keyword(utils::remove_all(ns, '_'));
177} 177}
178 178
179inline std::string managed_method_name(std::string const& klass, std::string const& name) 179inline std::string managed_method_name(attributes::function_def const& f)
180{ 180{
181 std::vector<std::string> names = utils::split(name, '_'); 181 std::vector<std::string> names = utils::split(f.name, '_');
182 182
183 name_helpers::reorder_verb(names); 183 name_helpers::reorder_verb(names);
184 184
185 std::string candidate = escape_keyword(utils::to_pascal_case(names)); 185 std::string candidate = escape_keyword(utils::to_pascal_case(names));
186 186
187 // Some eolian methods have the same name as their parent class 187 // Some eolian methods have the same name as their parent class
188 if (candidate == klass) 188 if (candidate == klass_concrete_or_interface_name(f.klass))
189 candidate = "Do" + candidate; 189 candidate = "Do" + candidate;
190 190
191 // Avoid clashing with System.Object.GetType 191 // Avoid clashing with System.Object.GetType
192 if (candidate == "GetType" || candidate == "SetType") 192 if (candidate == "GetType" || candidate == "SetType")
193 { 193 {
194 candidate.insert(3, klass); 194 candidate.insert(3, f.klass.eolian_name);
195 } 195 }
196 196
197 return candidate; 197 return candidate;
@@ -203,11 +203,6 @@ inline std::string managed_name(std::string const& name, char separator='_')
203 return utils::to_pascal_case(tokens); 203 return utils::to_pascal_case(tokens);
204} 204}
205 205
206inline std::string managed_method_name(attributes::function_def const& f)
207{
208 return managed_method_name(f.klass.eolian_name, f.name);
209}
210
211inline std::string alias_full_eolian_name(attributes::alias_def const& alias) 206inline std::string alias_full_eolian_name(attributes::alias_def const& alias)
212{ 207{
213 208