mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-24 18:48:01 +02:00
Boxed struct ptr changes.
This commit is contained in:
parent
ad2542eba6
commit
5af6428bf4
20 changed files with 573 additions and 327 deletions
|
@ -1,12 +1,29 @@
|
|||
namespace System
|
||||
{
|
||||
struct Pointer
|
||||
[AlwaysInclude]
|
||||
struct Pointer : IHashable
|
||||
{
|
||||
void* mVal;
|
||||
|
||||
public int GetHashCode()
|
||||
{
|
||||
return (int)mVal;
|
||||
}
|
||||
|
||||
[AlwaysInclude]
|
||||
Object GetBoxed()
|
||||
{
|
||||
return new box this;
|
||||
}
|
||||
}
|
||||
|
||||
struct Pointer<T>
|
||||
struct Pointer<T> : IHashable
|
||||
{
|
||||
T* mVal;
|
||||
|
||||
public int GetHashCode()
|
||||
{
|
||||
return (int)mVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,26 +154,35 @@ namespace System.Reflection
|
|||
Type underlyingType = argType.UnderlyingType;
|
||||
if ((paramType.IsPrimitive) && (underlyingType.IsTypedPrimitive)) // Boxed primitive?
|
||||
underlyingType = underlyingType.UnderlyingType;
|
||||
if (!underlyingType.IsSubtypeOf(paramType))
|
||||
|
||||
if (argType.IsBoxedStructPtr)
|
||||
{
|
||||
if (underlyingType.IsGenericType)
|
||||
dataPtr = *(void**)dataPtr;
|
||||
handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!underlyingType.IsSubtypeOf(paramType))
|
||||
{
|
||||
var ptrTypedPrimitive = (SpecializedGenericType)underlyingType;
|
||||
if ((ptrTypedPrimitive.mTypeFlags.HasFlag(.Sys_PointerT)))
|
||||
if (underlyingType.IsGenericType)
|
||||
{
|
||||
let elementType = Type.GetType(ptrTypedPrimitive.mResolvedTypeRefs[0]);
|
||||
if (elementType == paramType)
|
||||
var ptrTypedPrimitive = (SpecializedGenericType)underlyingType;
|
||||
if ((ptrTypedPrimitive.mTypeFlags.HasFlag(.Sys_PointerT)))
|
||||
{
|
||||
dataPtr = *(void**)dataPtr;
|
||||
handled = true;
|
||||
let elementType = Type.GetType(ptrTypedPrimitive.mResolvedTypeRefs[0]);
|
||||
if (elementType == paramType)
|
||||
{
|
||||
dataPtr = *(void**)dataPtr;
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if (underlyingType.IsSpecialType(TypeInstance.[Friend]sPointerTType, "System", "Pointer", 2))
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
/*if (underlyingType.IsSpecialType(TypeInstance.[Friend]sPointerTType, "System", "Pointer", 2))
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
|
|
|
@ -213,6 +213,14 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsPointer
|
||||
{
|
||||
get
|
||||
{
|
||||
return (mTypeFlags & (TypeFlags.Boxed | TypeFlags.Pointer)) == TypeFlags.Pointer;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBoxed
|
||||
{
|
||||
get
|
||||
|
@ -221,6 +229,14 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsBoxedStructPtr
|
||||
{
|
||||
get
|
||||
{
|
||||
return (mTypeFlags & (TypeFlags.Boxed | TypeFlags.Pointer)) == TypeFlags.Boxed | TypeFlags.Pointer;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnum
|
||||
{
|
||||
get
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue