mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed erroneous readonly of non-sret composite returns (ie: comptime)
This commit is contained in:
parent
044d5d5f03
commit
e79b8ca9df
2 changed files with 15 additions and 0 deletions
|
@ -7259,6 +7259,20 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
|
|||
auto func = moduleMethodInstance.mFunc;
|
||||
BfTypedValue callResult = CreateCall(targetSrc, methodInstance, func, bypassVirtual, irArgs);
|
||||
|
||||
// This gets triggered for non-sret (ie: comptime) composite returns so they aren't considered readonly
|
||||
if ((callResult.mKind == BfTypedValueKind_Value) && (!callResult.mValue.IsConst()) &&
|
||||
(!callResult.mType->IsValuelessType()) && (callResult.mType->IsComposite()) && (!methodInstance->GetLoweredReturnType()))
|
||||
{
|
||||
bool makeAddressable = true;
|
||||
auto typeInstance = callResult.mType->ToTypeInstance();
|
||||
if ((typeInstance != NULL) && (typeInstance->mHasUnderlyingArray))
|
||||
makeAddressable = false;
|
||||
if (makeAddressable)
|
||||
{
|
||||
callResult = mModule->MakeAddressable(callResult, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (argCascades.mSize == 1)
|
||||
{
|
||||
if (argCascade == NULL)
|
||||
|
|
|
@ -6524,6 +6524,7 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
|||
{
|
||||
if (mIsComptimeModule)
|
||||
{
|
||||
retVal = LoadValue(retVal);
|
||||
mBfIRBuilder->CreateStore(retVal.mValue, nextResult.mValue);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue