diff options
author | Yeongjong Lee <yj34.lee@samsung.com> | 2019-09-10 19:47:47 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-09-10 19:47:47 -0300 |
commit | 4bacfe155f9161d09b19a81bb38080d2d53cd5bd (patch) | |
tree | 08f318b74f12f9f12607e4e936bf426a54ec4186 | |
parent | dfb856158c8ea37d9caa170a6794447ec18ecdd9 (diff) | |
download | efl-4bacfe155f9161d09b19a81bb38080d2d53cd5bd.tar.gz |
csharp: skip static members from interfaces
Summary:
Static methods of eo-interface are generated in c# interface-concrete. there are
4 methods
`efl_access_object_access_root_get`, `efl_access_object_event_emit`,
`efl_access_object_event_handler_add`, `efl_access_object_event_handler_del`
If a class that inherits that interface, static method can't be called via
classname.
This commit changes eolian_mono by removing those static members from the C#
interface-concretes. If a generated class implements the interface, the static
member is generated as static member of the class directly.
Depends on D9800
Test Plan: Check that `Efl.Ui.Widget` has `public static Efl.Object AccessRoot` property.
Reviewers: lauromoura, felipealmeida
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9893
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/function_definition.hh | 14 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/helpers.hh | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh index 51da954d44..a0f28df305 100644 --- a/src/bin/eolian_mono/eolian/mono/function_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh @@ -85,6 +85,11 @@ struct native_function_definition_generator if (blacklist::is_non_public_interface_member(f, *klass)) return true; + // Do not generate static method in interface + if (((klass->type == attributes::class_type::interface_) || + (klass->type == attributes::class_type::mixin)) && f.is_static) + return true; + // Actual method implementation to be called from C. std::string return_type; if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context)) @@ -171,9 +176,15 @@ struct function_definition_generator bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const { EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_definition_generator: " << f.c_name << std::endl; + + bool is_concrete = context_find_tag<class_context>(context).current_wrapper_kind == class_context::concrete; if(blacklist::is_function_blacklisted(f, context)) return true; + // Do not generate static function for concrete class + if (is_concrete && f.is_static) + return true; + std::string return_type; if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context)) return false; @@ -310,9 +321,10 @@ struct property_wrapper_definition_generator bool is_interface = context_find_tag<class_context>(context).current_wrapper_kind == class_context::interface; bool is_static = (property.getter.is_engaged() && property.getter->is_static) || (property.setter.is_engaged() && property.setter->is_static); + bool is_concrete = context_find_tag<class_context>(context).current_wrapper_kind == class_context::concrete; - if (is_interface && is_static) + if ((is_concrete || is_interface) && is_static) return true; auto get_params = property.getter.is_engaged() ? property.getter->parameters.size() : 0; diff --git a/src/bin/eolian_mono/eolian/mono/helpers.hh b/src/bin/eolian_mono/eolian/mono/helpers.hh index 291e5234ff..5c1db6df24 100644 --- a/src/bin/eolian_mono/eolian/mono/helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/helpers.hh @@ -258,6 +258,9 @@ std::vector<attributes::function_def> get_all_registerable_methods(attributes::k if (cls == func.klass) return true; + if (is_managed_interface(func.klass) && func.is_static) + return true; + if (!is_managed_interface(func.klass) || func.scope != attributes::member_scope::scope_public) return true; return false; |