diff --git a/src/bin/eolian_mono/eolian/mono/function_helpers.hh b/src/bin/eolian_mono/eolian/mono/function_helpers.hh index a8559fd5d3..4b9447f324 100644 --- a/src/bin/eolian_mono/eolian/mono/function_helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/function_helpers.hh @@ -187,6 +187,11 @@ inline std::string function_scope_get(attributes::function_def const& f) case attributes::member_scope::scope_private: return "private "; case attributes::member_scope::scope_protected: + // Efl.Part.part.get is protected in C to force developers to use `efl_part`. + // There is no such restriction in C# as the binding takes care of the returned + // object lifetime. + if (f.c_name == "efl_part_get") + return "public "; return "protected "; case attributes::member_scope::scope_unknown: // This should trigger a compilation error diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs index e1ff3d9028..33ae37d2a4 100644 --- a/src/tests/efl_mono/Parts.cs +++ b/src/tests/efl_mono/Parts.cs @@ -81,6 +81,20 @@ public static class TestMVVMParts } } +public static class TestNamedParts +{ + public static void named_parts() + { + var obj = new Dummy.PartHolder(); + var p1 = obj.GetPart("one"); + var p2 = obj.GetPart("two"); + Test.Assert(p1 is Dummy.TestObject); + Test.AssertEquals("part_one", p1.GetName()); + Test.Assert(p2 is Dummy.TestObject); + Test.AssertEquals("part_two", p2.GetName()); + } +} + #endif }