1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Generic outer type fixes, 'in' fixes

This commit is contained in:
Brian Fiete 2022-01-22 07:57:02 -05:00
parent 27a792e559
commit 89b597c913
6 changed files with 67 additions and 26 deletions

View file

@ -10917,7 +10917,7 @@ StringT<128> BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodName
methodName += methodInst->GetParamName(paramIdx);
auto paramInitializer = methodInst->GetParamInitializer(paramIdx);
if (paramInitializer != NULL)
if ((paramInitializer != NULL) && ((methodNameFlags & BfMethodNameFlag_NoAst) == 0))
{
methodName += " = ";
methodName += paramInitializer->ToString();
@ -12120,7 +12120,8 @@ BfTypedValue BfModule::ToRef(BfTypedValue typedValue, BfRefType* refType)
if (refType->mRefKind == BfRefType::RefKind_Mut)
refType = CreateRefType(typedValue.mType);
typedValue = MakeAddressable(typedValue);
if (!typedValue.mType->IsValuelessType())
typedValue = MakeAddressable(typedValue, false, true);
return BfTypedValue(typedValue.mValue, refType);
}
@ -12377,12 +12378,13 @@ void BfModule::AggregateSplatIntoAddr(BfTypedValue typedValue, BfIRValue addrVal
checkTypeLambda(typedValue.mType, addrVal);
}
BfTypedValue BfModule::MakeAddressable(BfTypedValue typedVal, bool forceMutable)
BfTypedValue BfModule::MakeAddressable(BfTypedValue typedVal, bool forceMutable, bool forceAddressable)
{
bool wasReadOnly = typedVal.IsReadOnly();
if ((typedVal.mType->IsValueType()) &&
(!typedVal.mType->IsValuelessType()))
if ((forceAddressable) ||
((typedVal.mType->IsValueType()) &&
(!typedVal.mType->IsValuelessType())))
{
wasReadOnly = true; // Any non-addr is implicitly read-only