mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fixed dynamic boxability of wrappable types (such as pointers)
This commit is contained in:
parent
befcbf3ddc
commit
ee71c8c97b
2 changed files with 3 additions and 13 deletions
|
@ -313,24 +313,14 @@ namespace System
|
|||
if (IsObject)
|
||||
return .Err;
|
||||
|
||||
var self = this;
|
||||
var type = VariantType;
|
||||
void* dataPtr = self.DataPtr;
|
||||
if (type.IsPointer)
|
||||
{
|
||||
type = type.UnderlyingType;
|
||||
var boxedType = type.BoxedType;
|
||||
if (boxedType == null)
|
||||
return .Err;
|
||||
dataPtr = (void*)mData;
|
||||
}
|
||||
|
||||
var boxedType = type.BoxedType;
|
||||
if (boxedType == null)
|
||||
return .Err;
|
||||
|
||||
var self = this;
|
||||
var object = Try!(boxedType.CreateObject());
|
||||
Internal.MemCpy((uint8*)Internal.UnsafeCastToPtr(object) + boxedType.[Friend]mMemberDataOffset, dataPtr, type.Size);
|
||||
Internal.MemCpy((uint8*)Internal.UnsafeCastToPtr(object) + boxedType.[Friend]mMemberDataOffset, self.DataPtr, type.Size);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
@ -4934,7 +4934,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
}
|
||||
|
||||
int boxedTypeId = 0;
|
||||
if (type->IsValueType())
|
||||
if ((type->IsValueType()) || (type->IsWrappableType()))
|
||||
{
|
||||
auto boxedType = CreateBoxedType(type, false);
|
||||
if ((boxedType != NULL) && (boxedType->mIsReified))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue