eolian_mono: fix to call mixin's method in inherited class

Summary:
Eo mixin is converted to C# interface and C# concrete class.
When the mixin's method is called, the delegate function of Eo mixin's
C# concrete class is called.

Now, the delegate function of Eo mixin's C# concrete class calls C#
method with casting to Eo mixin's C# concrete class type.
e.g. ((IClickableConcrete)ws.Target).Press(button);

If a user defined C# class implements Eo mixin's C# interface, the
implemented method cannot be called because the user defined C# class
type is not the same as Eo mixin's C# concrete class.

To resolve the above issue, the type casting code is fixed.

Reviewers: felipealmeida, lauromoura, vitor.sousa, YOhoho

Reviewed By: YOhoho

Subscribers: bu5hm4n, YOhoho, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9111
This commit is contained in:
Jaehyun Cho 2019-06-24 18:43:07 +09:00
parent 799b39afc5
commit 86afeee224
1 changed files with 4 additions and 3 deletions

View File

@ -85,10 +85,11 @@ struct native_function_definition_generator
return false;
std::string klass_cast_name;
if (klass->type != attributes::class_type::interface_)
klass_cast_name = name_helpers::klass_inherit_name(*klass);
else
if ((klass->type == attributes::class_type::interface_) ||
((klass->type == attributes::class_type::mixin) && !f.is_static))
klass_cast_name = name_helpers::klass_interface_name(*klass);
else
klass_cast_name = name_helpers::klass_inherit_name(*klass);
std::string self = "Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj))";