Page MenuHomePhabricator

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

Authored by Jaehyun_Cho on Jun 18 2019, 11:20 PM.

Details

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.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Jaehyun_Cho created this revision.Jun 18 2019, 11:20 PM
Jaehyun_Cho requested review of this revision.Jun 18 2019, 11:20 PM
YOhoho accepted this revision.Jun 19 2019, 12:26 AM
YOhoho added a subscriber: YOhoho.

Press method of my clickable custom slider works fine with this patch.

public class MySlider : Efl.Ui.Slider, Efl.Ui.IClickable
{
    public MySlider(Efl.Object parent, string style = null) : base(parent, style)
    {
        ClickableUtil.BindToObject(this, this);
    }
    public void Press(uint button)
    {   
        Eina.Log.Error("My slider Press!");
    }
This revision is now accepted and ready to land.Jun 19 2019, 12:26 AM

@YOhoho can you verify that calling the super function in ´Press´ also does work ?

@YOhoho can you verify that calling the super function in ´Press´ also does work ?

When if add base.Press(button), i got CS0117 Compiler Error (https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0117)
Because base is Efl.Ui.Slider and Efl.Ui.Slider does not contain Press method.

Okay, thank you :)

This revision was automatically updated to reflect the committed changes.