mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 05:44:11 +02:00
Fixed ToString of tuples with sized array members
This commit is contained in:
parent
34b0dd44a7
commit
ca1ac7fb4c
3 changed files with 20 additions and 3 deletions
|
@ -64,7 +64,7 @@ namespace System
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ToString(String strBuffer) mut
|
public override void ToString(String strBuffer)
|
||||||
{
|
{
|
||||||
if (typeof(T) == typeof(char8))
|
if (typeof(T) == typeof(char8))
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,7 @@ namespace System
|
||||||
if (mVal[len] == default)
|
if (mVal[len] == default)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#unwarn
|
||||||
strBuffer.Append((char8*)&mVal, len);
|
strBuffer.Append((char8*)&mVal, len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3081,6 +3081,12 @@ void BfMethodMatcher::TryDevirtualizeCall(BfTypedValue target, BfTypedValue* ori
|
||||||
{
|
{
|
||||||
auto structType = target.mType->ToTypeInstance();
|
auto structType = target.mType->ToTypeInstance();
|
||||||
|
|
||||||
|
if (structType == NULL)
|
||||||
|
{
|
||||||
|
mModule->InternalError("Invalid type in TryDevirtualizeCall");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto virtualMethodInstance = mModule->GetMethodInstance(mBestMethodTypeInstance, mBestMethodDef, BfTypeVector());
|
auto virtualMethodInstance = mModule->GetMethodInstance(mBestMethodTypeInstance, mBestMethodDef, BfTypeVector());
|
||||||
BF_ASSERT(virtualMethodInstance.mMethodInstance->mVirtualTableIdx != -1);
|
BF_ASSERT(virtualMethodInstance.mMethodInstance->mVirtualTableIdx != -1);
|
||||||
|
|
||||||
|
|
|
@ -18854,9 +18854,19 @@ void BfModule::EmitTupleToStringBody()
|
||||||
|
|
||||||
BfTypedValue fieldValue = ExtractValue(thisValue, &fieldInstance, fieldInstance.mDataIdx);
|
BfTypedValue fieldValue = ExtractValue(thisValue, &fieldInstance, fieldInstance.mDataIdx);
|
||||||
|
|
||||||
if (fieldValue.mType->IsPrimitiveType())
|
if (fieldValue.mType->IsWrappableType())
|
||||||
{
|
{
|
||||||
fieldValue.mType = GetPrimitiveStructType(((BfPrimitiveType*)fieldValue.mType)->mTypeDef->mTypeCode);
|
auto wrappedType = GetWrappedStructType(fieldValue.mType);
|
||||||
|
if ((wrappedType->IsTypedPrimitive()) || (wrappedType->IsValuelessType()))
|
||||||
|
{
|
||||||
|
fieldValue.mType = wrappedType;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fieldValue = MakeAddressable(fieldValue);
|
||||||
|
fieldValue.mType = wrappedType;
|
||||||
|
fieldValue.mValue = mBfIRBuilder->CreateBitCast(fieldValue.mValue, mBfIRBuilder->MapTypeInstPtr(fieldValue.mType->ToTypeInstance()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto typeInstance = fieldValue.mType->ToTypeInstance();
|
auto typeInstance = fieldValue.mType->ToTypeInstance();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue