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
This commit is contained in:
Bruno da Silva Belo 2019-10-24 18:50:48 -03:00 committed by Lauro Moura
parent 6231d5f252
commit 1adb765879
2 changed files with 19 additions and 13 deletions

View File

@ -64,7 +64,7 @@ struct function_registration_generator
return false; return false;
if(!as_generator( if(!as_generator(
indent << "if (methods.FirstOrDefault(m => m.Name == \"" << string << "\") != null)\n" indent << "if (methods.Contains(\"" << string << "\"))\n"
<< indent << "{\n" << indent << "{\n"
<< indent << scope_tab << "descs.Add(new EflOpDescription() {" << indent << scope_tab << "descs.Add(new EflOpDescription() {"
#ifdef _WIN32 #ifdef _WIN32

View File

@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using System.Linq;
using static Eina.NativeCustomExportFunctions; using static Eina.NativeCustomExportFunctions;
using EoG = Efl.Eo.Globals; using EoG = Efl.Eo.Globals;
@ -368,26 +369,31 @@ public static class Globals
return null; return null;
} }
public static System.Collections.Generic.List<System.Reflection.MethodInfo> public static System.Collections.Generic.List<string>
GetUserMethods(System.Type type) GetUserMethods(System.Type type)
{ {
var r = new System.Collections.Generic.List<System.Reflection.MethodInfo>(); var r = new System.Collections.Generic.List<string>();
var flags = System.Reflection.BindingFlags.Instance var flags =
| System.Reflection.BindingFlags.DeclaredOnly System.Reflection.BindingFlags.Instance
| System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly
| System.Reflection.BindingFlags.NonPublic; | System.Reflection.BindingFlags.Public
r.AddRange(type.GetMethods(flags)); | System.Reflection.BindingFlags.NonPublic;
var base_type = type.BaseType;
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; return r;
} }