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
This commit is contained in:
Yeongjong Lee 2019-09-10 19:47:47 -03:00 committed by Lauro Moura
parent dfb856158c
commit 4bacfe155f
2 changed files with 16 additions and 1 deletions

View File

@ -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;

View File

@ -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;