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)
|
if (IsObject)
|
||||||
return .Err;
|
return .Err;
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var type = VariantType;
|
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;
|
var boxedType = type.BoxedType;
|
||||||
if (boxedType == null)
|
if (boxedType == null)
|
||||||
return .Err;
|
return .Err;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
var object = Try!(boxedType.CreateObject());
|
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;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4934,7 +4934,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
}
|
}
|
||||||
|
|
||||||
int boxedTypeId = 0;
|
int boxedTypeId = 0;
|
||||||
if (type->IsValueType())
|
if ((type->IsValueType()) || (type->IsWrappableType()))
|
||||||
{
|
{
|
||||||
auto boxedType = CreateBoxedType(type, false);
|
auto boxedType = CreateBoxedType(type, false);
|
||||||
if ((boxedType != NULL) && (boxedType->mIsReified))
|
if ((boxedType != NULL) && (boxedType->mIsReified))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue