mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-18 16:10:26 +02:00
Comptime method reflection fixes
This commit is contained in:
parent
db839035c0
commit
9de99cd422
2 changed files with 23 additions and 3 deletions
|
@ -29,8 +29,8 @@ namespace System.Reflection
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Compiler.IsComptime)
|
if (Compiler.IsComptime)
|
||||||
Type.[Friend]Comptime_Method_GetName(mNativeMethodInstance);
|
return Type.[Friend]Comptime_Method_GetName(mNativeMethodInstance);
|
||||||
return "";
|
return "?";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int ParamCount
|
public int ParamCount
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace System
|
||||||
if (matched.[Friend]mMethodData != null)
|
if (matched.[Friend]mMethodData != null)
|
||||||
return .Err(.MultipleResults);
|
return .Err(.MultipleResults);
|
||||||
else
|
else
|
||||||
matched = methodInfo;
|
matched = methodInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,26 @@ namespace System
|
||||||
return .Ok(matched);
|
return .Ok(matched);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Comptime]
|
||||||
|
public virtual Result<ComptimeMethodInfo, MethodError> 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<MethodInfo, MethodError> GetMethod(int methodIdx)
|
public virtual Result<MethodInfo, MethodError> GetMethod(int methodIdx)
|
||||||
{
|
{
|
||||||
return .Err(.NoResults);
|
return .Err(.NoResults);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue