summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2020-01-23 07:30:13 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2020-01-23 07:30:14 +0900
commit97098dcc50b62e51dad3469619ed55242ca01a80 (patch)
tree33d372fef1f883a12f4172ceb9ab07223ca28805 /src/bindings
parent5137f6d143c681fcf4f53e4e45df8af1a538ae75 (diff)
csharp: cleanup concrete class
Summary: Concrete class is only used to call static member of NativeMethod. they don't need any inheritance and implementation of c functions. Depends on D9893 Test Plan: ninja test Reviewers: lauromoura, felipealmeida Subscribers: Jaehyun_Cho, woohyun, segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9894
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/mono/eina_mono/eina_container_common.cs24
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs12
2 files changed, 5 insertions, 31 deletions
diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs
index 192469a033..a07153e51a 100644
--- a/src/bindings/mono/eina_mono/eina_container_common.cs
+++ b/src/bindings/mono/eina_mono/eina_container_common.cs
@@ -1003,22 +1003,6 @@ internal static class TraitFunctions
1003 1003
1004 private static IDictionary<System.Type, object> register = new Dictionary<System.Type, object>(); 1004 private static IDictionary<System.Type, object> register = new Dictionary<System.Type, object>();
1005 1005
1006 private static System.Type AsEflInstantiableType(System.Type type)
1007 {
1008 if (!IsEflObject(type))
1009 {
1010 return null;
1011 }
1012
1013 if (type.IsInterface)
1014 {
1015 string fullName = type.FullName + "Concrete";
1016 return type.Assembly.GetType(fullName); // That was our best guess...
1017 }
1018
1019 return type; // Not interface, so it should be a concrete.
1020 }
1021
1022 public static object RegisterTypeTraits<T>() 1006 public static object RegisterTypeTraits<T>()
1023 { 1007 {
1024 Eina.Log.Debug($"Finding TypeTraits for {typeof(T).Name}"); 1008 Eina.Log.Debug($"Finding TypeTraits for {typeof(T).Name}");
@@ -1026,14 +1010,6 @@ internal static class TraitFunctions
1026 var type = typeof(T); 1010 var type = typeof(T);
1027 if (IsEflObject(type)) 1011 if (IsEflObject(type))
1028 { 1012 {
1029 System.Type concrete = AsEflInstantiableType(type);
1030 if (concrete == null || !type.IsAssignableFrom(concrete))
1031 {
1032 throw new Exception("Failed to get a suitable concrete class for this type.");
1033 }
1034
1035 // No need to pass concrete as the traits class will use reflection to get the actually most
1036 // derived type returned.
1037 traits = new EflObjectElementTraits<T>(); 1013 traits = new EflObjectElementTraits<T>();
1038 } 1014 }
1039 else if (IsString(type)) 1015 else if (IsString(type))
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 780735fcca..ceae250bc9 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -1221,14 +1221,12 @@ internal static class ClassRegister
1221 1221
1222 if (objectType.IsInterface) 1222 if (objectType.IsInterface)
1223 { 1223 {
1224 // Try to get the *Concrete class 1224 // Try to get the *NativeMethods class
1225 var assembly = objectType.Assembly; 1225 var nativeMethods = (Efl.Eo.NativeClass)System.Attribute.GetCustomAttributes(objectType)?.FirstOrDefault(attr => attr is Efl.Eo.NativeClass);
1226 objectType = assembly.GetType(objectType.FullName + "Concrete"); 1226 if (nativeMethods == null)
1227
1228 if (objectType == null)
1229 {
1230 return IntPtr.Zero; 1227 return IntPtr.Zero;
1231 } 1228
1229 return nativeMethods.GetEflClass();
1232 } 1230 }
1233 1231
1234 var method = objectType.GetMethod("GetEflClassStatic", 1232 var method = objectType.GetMethod("GetEflClassStatic",