From 86afeee2246ebb9d58dc5676d58df137f5ba764c Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Mon, 24 Jun 2019 18:43:07 +0900 Subject: [PATCH] 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 --- src/bin/eolian_mono/eolian/mono/function_definition.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh index 8fc7225bf3..861092d40a 100644 --- a/src/bin/eolian_mono/eolian/mono/function_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh @@ -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))";