diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-11-07 17:59:40 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-11-07 17:59:40 -0300 |
commit | cb60b595d3bbbf9bafed05b7b5fdbf5dd8e04e44 (patch) | |
tree | 6aa793a48f23ad939617f5640d17b07c76c52491 | |
parent | d907aa5285c1805efc76aac269bc05450b51e8f1 (diff) |
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
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/function_helpers.hh | 5 | ||||
-rw-r--r-- | src/tests/efl_mono/Parts.cs | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_helpers.hh b/src/bin/eolian_mono/eolian/mono/function_helpers.hh index a8559fd..4b9447f 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) | |||
187 | case attributes::member_scope::scope_private: | 187 | case attributes::member_scope::scope_private: |
188 | return "private "; | 188 | return "private "; |
189 | case attributes::member_scope::scope_protected: | 189 | case attributes::member_scope::scope_protected: |
190 | // Efl.Part.part.get is protected in C to force developers to use `efl_part`. | ||
191 | // There is no such restriction in C# as the binding takes care of the returned | ||
192 | // object lifetime. | ||
193 | if (f.c_name == "efl_part_get") | ||
194 | return "public "; | ||
190 | return "protected "; | 195 | return "protected "; |
191 | case attributes::member_scope::scope_unknown: | 196 | case attributes::member_scope::scope_unknown: |
192 | // This should trigger a compilation error | 197 | // This should trigger a compilation error |
diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs index e1ff3d9..33ae37d 100644 --- a/src/tests/efl_mono/Parts.cs +++ b/src/tests/efl_mono/Parts.cs | |||
@@ -81,6 +81,20 @@ public static class TestMVVMParts | |||
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public static class TestNamedParts | ||
85 | { | ||
86 | public static void named_parts() | ||
87 | { | ||
88 | var obj = new Dummy.PartHolder(); | ||
89 | var p1 = obj.GetPart("one"); | ||
90 | var p2 = obj.GetPart("two"); | ||
91 | Test.Assert(p1 is Dummy.TestObject); | ||
92 | Test.AssertEquals("part_one", p1.GetName()); | ||
93 | Test.Assert(p2 is Dummy.TestObject); | ||
94 | Test.AssertEquals("part_two", p2.GetName()); | ||
95 | } | ||
96 | } | ||
97 | |||
84 | #endif | 98 | #endif |
85 | 99 | ||
86 | } | 100 | } |