csharp: Make GetPart public.

Summary:
`efl_part_get` is protected in C due to the presence of `efl_part`,
which does automatic refcount management in single method calls.

The C# binding has no limitation on this as it already handles the
lifetime for all objects.

Fixes T8462

Reviewers: brunobelo, segfaultxavi, SanghyeonLee

Reviewed By: SanghyeonLee

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8462

Differential Revision: https://phab.enlightenment.org/D10594
This commit is contained in:
Lauro Moura 2019-11-07 17:59:40 -03:00
parent d907aa5285
commit cb60b595d3
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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
}