summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-10-24 18:50:48 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-24 19:25:35 -0300
commit1adb7658790a705e19d3d4350800eb6269a7a612 (patch)
tree5034e433f0d649a8560cbdd0d9e24a5dda74236b
parent6231d5f2528ecc71a3f45636ea33eefb1e34678e (diff)
downloadefl-1adb7658790a705e19d3d4350800eb6269a7a612.tar.gz
csharp: Returning only method name iwrapper.
Summary: GetUserMethods returning only strings, not the whole method informations. Reviewers: lauromoura, felipealmeida Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10503
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_registration.hh2
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs30
2 files changed, 19 insertions, 13 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_registration.hh b/src/bin/eolian_mono/eolian/mono/function_registration.hh
index 55e76dbbfa..bef9e21384 100644
--- a/src/bin/eolian_mono/eolian/mono/function_registration.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_registration.hh
@@ -64,7 +64,7 @@ struct function_registration_generator
return false;
if(!as_generator(
- indent << "if (methods.FirstOrDefault(m => m.Name == \"" << string << "\") != null)\n"
+ indent << "if (methods.Contains(\"" << string << "\"))\n"
<< indent << "{\n"
<< indent << scope_tab << "descs.Add(new EflOpDescription() {"
#ifdef _WIN32
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 5154c4b2a2..d9ae4e56c5 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
+using System.Linq;
using static Eina.NativeCustomExportFunctions;
using EoG = Efl.Eo.Globals;
@@ -368,26 +369,31 @@ public static class Globals
return null;
}
- public static System.Collections.Generic.List<System.Reflection.MethodInfo>
+ public static System.Collections.Generic.List<string>
GetUserMethods(System.Type type)
{
- var r = new System.Collections.Generic.List<System.Reflection.MethodInfo>();
- var flags = System.Reflection.BindingFlags.Instance
- | System.Reflection.BindingFlags.DeclaredOnly
- | System.Reflection.BindingFlags.Public
- | System.Reflection.BindingFlags.NonPublic;
- r.AddRange(type.GetMethods(flags));
- var base_type = type.BaseType;
+ var r = new System.Collections.Generic.List<string>();
+ var flags =
+ System.Reflection.BindingFlags.Instance
+ | System.Reflection.BindingFlags.DeclaredOnly
+ | System.Reflection.BindingFlags.Public
+ | System.Reflection.BindingFlags.NonPublic;
- for (;base_type != null; base_type = base_type.BaseType)
+ for (var base_type = type;;base_type = base_type.BaseType)
{
- if (IsGeneratedClass(base_type))
+ r.AddRange(base_type.GetMethods(flags)
+ .AsParallel().Select(info=>info.Name).ToList());
+ if (IsGeneratedClass(base_type.BaseType))
{
- return r;
+ break;
}
- r.AddRange(base_type.GetMethods(flags));
+ if (base_type.BaseType == null)
+ {
+ break;
+ }
}
+
return r;
}