summaryrefslogtreecommitdiff
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
parent68fe9ec6bf60b4730ad7fdbf2698dc7aa130b94d (diff)
downloadefl-cb0c20eaf3ba89ab850af5b813e6ddfb6cc4a15a.tar.gz
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
-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
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);
}
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)
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)
{