mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue