mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
Improved reflection method invocation argument handling
This commit is contained in:
parent
fa3b69e0c7
commit
bc46807003
3 changed files with 15 additions and 6 deletions
|
@ -671,24 +671,28 @@ namespace System.Reflection
|
|||
}
|
||||
else if (paramType.IsValueType)
|
||||
{
|
||||
handled = true;
|
||||
|
||||
if (!argType.IsBoxed)
|
||||
return .Err(.InvalidArgument((.)argIdx));
|
||||
|
||||
Type underlyingType = argType.UnderlyingType;
|
||||
if (underlyingType == paramType)
|
||||
handled = true;
|
||||
|
||||
if ((paramType.IsPrimitive) && (underlyingType.IsTypedPrimitive)) // Boxed primitive?
|
||||
underlyingType = underlyingType.UnderlyingType;
|
||||
|
||||
if (argType.IsBoxedStructPtr || argType.IsBoxedPrimitivePtr)
|
||||
if ((paramType.IsTypedPrimitive) && (underlyingType.IsTypedPrimitive) &&
|
||||
(paramType.UnderlyingType == underlyingType.UnderlyingType))
|
||||
{
|
||||
dataPtr = *(void**)dataPtr;
|
||||
handled = true;
|
||||
}
|
||||
else
|
||||
else if (argType.IsBoxedStructPtr || argType.IsBoxedPrimitivePtr)
|
||||
{
|
||||
isValid = underlyingType == paramType;
|
||||
dataPtr = *(void**)dataPtr;
|
||||
}
|
||||
|
||||
if (underlyingType == paramType)
|
||||
handled = true;
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue