diff --git a/BeefLibs/corlib/src/Reflection/CEMethodInfo.bf b/BeefLibs/corlib/src/Reflection/CEMethodInfo.bf index cc13dad1..996d4480 100644 --- a/BeefLibs/corlib/src/Reflection/CEMethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/CEMethodInfo.bf @@ -29,8 +29,8 @@ namespace System.Reflection get { if (Compiler.IsComptime) - Type.[Friend]Comptime_Method_GetName(mNativeMethodInstance); - return ""; + return Type.[Friend]Comptime_Method_GetName(mNativeMethodInstance); + return "?"; } } public int ParamCount diff --git a/BeefLibs/corlib/src/Reflection/TypeInstance.bf b/BeefLibs/corlib/src/Reflection/TypeInstance.bf index eefc5f0a..571c0704 100644 --- a/BeefLibs/corlib/src/Reflection/TypeInstance.bf +++ b/BeefLibs/corlib/src/Reflection/TypeInstance.bf @@ -32,7 +32,7 @@ namespace System if (matched.[Friend]mMethodData != null) return .Err(.MultipleResults); else - matched = methodInfo; + matched = methodInfo; } } @@ -41,6 +41,26 @@ namespace System return .Ok(matched); } + [Comptime] + public virtual Result GetMethod(StringView methodName, BindingFlags bindingFlags = cDefaultLookup) + { + ComptimeMethodInfo matched = default; + for (let methodInfo in ComptimeMethodInfo.Enumerator(this as TypeInstance, bindingFlags)) + { + if (methodInfo.Name == methodName) + { + if (matched.mNativeMethodInstance != 0) + return .Err(.MultipleResults); + else + matched = methodInfo; + } + } + + if (matched.mNativeMethodInstance == 0) + return .Err(.NoResults); + return .Ok(matched); + } + public virtual Result GetMethod(int methodIdx) { return .Err(.NoResults);