From cade1b3c3ccacf9f47f5aeb366f5686eff232f6c Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Wed, 22 Jan 2020 09:40:18 +0900 Subject: [PATCH] eolian_mono: avoid generating set-only property Summary: According to Property Design Guidelines of MS, set-only properties are not recommeneded. (see more, https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/property) Furthermore, there is stylecop warnings(CA1044) ref T8396 List of removed set-only properies. ``` Efl.Access.Editable.IText.TextContent { set; } Efl.App.CommandArray { set; } Efl.App.CommandString { set; } Efl.Canvas.Filter.IInternal.FilterChanged { set; } Efl.Canvas.Filter.IInternal.FilterInvalid { set; } Efl.Canvas.ImageInternal.FilterChanged { set; } Efl.Canvas.ImageInternal.FilterInvalid { set; } Efl.Canvas.Textblock.FilterChanged { set; } Efl.Canvas.Textblock.FilterInvalid { set; } Efl.Canvas.Vg.Image.Data { set; } Efl.Canvas.Vg.Node.CompMethod { set; } Efl.Core.ICommandLine.CommandArray { set; } Efl.Core.ICommandLine.CommandString { set; } Efl.Exe.CommandArray { set; } Efl.Exe.CommandString { set; } Efl.Ui.AlertPopup.Button { set; } Efl.Ui.Collection.MatchContent { set; } Efl.Ui.CollectionView.MatchContent { set; } Efl.Ui.IScrollable.MatchContent { set; } Efl.Ui.ImageZoomable.MatchContent { set; } Efl.Ui.Panel.MatchContent { set; } Efl.Ui.PositionManager.Grid.DataAccess { set; } Efl.Ui.PositionManager.Grid.ScrollPosition { set; } Efl.Ui.PositionManager.Grid.Viewport { set; } Efl.Ui.PositionManager.IDataAccessV1.DataAccess { set; } Efl.Ui.PositionManager.IEntity.ScrollPosition { set; } Efl.Ui.PositionManager.IEntity.Viewport { set; } Efl.Ui.PositionManager.List.DataAccess { set; } Efl.Ui.PositionManager.List.ScrollPosition { set; } Efl.Ui.PositionManager.List.Viewport { set; } Efl.Ui.Scroll.Manager.MatchContent { set; } Efl.Ui.Scroll.Manager.Pan { set; } Efl.Ui.Scroller.MatchContent { set; } Efl.Ui.Spotlight.Manager.Size { set; } Efl.Ui.Textbox.TextContent { set; } Efl.Ui.Widget.ResizeObject { set; } Efl.Ui.Win.PropFocusSkip { set; } ``` Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: woohyun, felipealmeida, segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8396 Differential Revision: https://phab.enlightenment.org/D11138 --- src/bin/eolian_mono/eolian/mono/function_definition.hh | 4 ++++ src/tests/efl_mono/Eo.cs | 2 +- src/tests/efl_mono/Events.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh index eff586b157..fcc8a88f15 100644 --- a/src/bin/eolian_mono/eolian/mono/function_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh @@ -428,6 +428,10 @@ struct property_wrapper_definition_generator if (is_interface && (!is_get_public && !is_set_public)) return true; + // Do not generate set-only proeprty + if (property.setter.is_engaged() && !property.getter.is_engaged()) + return true; + // C# interface members are declared automatically as public if (is_interface) { diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs index 7c580480ad..70e9d29c16 100644 --- a/src/tests/efl_mono/Eo.cs +++ b/src/tests/efl_mono/Eo.cs @@ -407,7 +407,7 @@ class TestCsharpProperties var obj = new Dummy.TestObject(); int val = -1984; - obj.SetterOnly = val; + obj.SetSetterOnly(val); Test.AssertEquals(val, obj.GetSetterOnly()); obj.Dispose(); } diff --git a/src/tests/efl_mono/Events.cs b/src/tests/efl_mono/Events.cs index 5f8cc0fa52..c10c37911e 100644 --- a/src/tests/efl_mono/Events.cs +++ b/src/tests/efl_mono/Events.cs @@ -320,7 +320,7 @@ class TestEventWithDeadWrappers EventHandler cb) { var obj = new Dummy.TestObject(); - manager.Emitter = obj; + manager.SetEmitter(obj); obj.EvtWithIntEvent += cb; return new WeakReference(obj);