mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Fixed deferred delete:null
This commit is contained in:
parent
3378293ea9
commit
44a4702ab4
1 changed files with 15 additions and 4 deletions
|
@ -3843,7 +3843,7 @@ void BfModule::Visit(BfDeleteStatement* deleteStmt)
|
||||||
|
|
||||||
if ((!checkType->IsPointer()) && (!checkType->IsObject()))
|
if ((!checkType->IsPointer()) && (!checkType->IsObject()))
|
||||||
{
|
{
|
||||||
Fail(StrFormat("Cannot delete a value of type '%s'", TypeToString(val.mType).c_str()), deleteStmt->mDeleteToken);
|
Fail(StrFormat("Cannot delete a value of type '%s'", TypeToString(val.mType).c_str()), deleteStmt->mExpression);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3996,7 +3996,12 @@ void BfModule::Visit(BfDeleteStatement* deleteStmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((customAllocator) && (customAllocator.mType != GetPrimitiveType(BfTypeCode_NullPtr)))
|
if (customAllocator.mType == GetPrimitiveType(BfTypeCode_NullPtr))
|
||||||
|
{
|
||||||
|
if (!checkType->IsObjectOrInterface())
|
||||||
|
Warn(0, "Type '%' has no destructor, so delete:null has no effect", deleteStmt->mExpression);
|
||||||
|
}
|
||||||
|
else if (customAllocator)
|
||||||
{
|
{
|
||||||
auto voidPtrType = GetPrimitiveType(BfTypeCode_NullPtr);
|
auto voidPtrType = GetPrimitiveType(BfTypeCode_NullPtr);
|
||||||
auto ptrValue = BfTypedValue(mBfIRBuilder->CreateBitCast(val.mValue, mBfIRBuilder->MapType(voidPtrType)), voidPtrType);
|
auto ptrValue = BfTypedValue(mBfIRBuilder->CreateBitCast(val.mValue, mBfIRBuilder->MapType(voidPtrType)), voidPtrType);
|
||||||
|
@ -6626,7 +6631,13 @@ void BfModule::Visit(BfDeferStatement* deferStmt)
|
||||||
if (isGenericParam)
|
if (isGenericParam)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (customAllocator)
|
bool isDtorOnly = false;
|
||||||
|
if (customAllocator.mType == GetPrimitiveType(BfTypeCode_NullPtr))
|
||||||
|
{
|
||||||
|
if (!checkType->IsObjectOrInterface())
|
||||||
|
Warn(0, "Type '%' has no destructor, so delete:null has no effect", deleteStmt->mExpression);
|
||||||
|
}
|
||||||
|
else if (customAllocator)
|
||||||
{
|
{
|
||||||
BfFunctionBindResult functionBindResult;
|
BfFunctionBindResult functionBindResult;
|
||||||
functionBindResult.mWantsArgs = true;
|
functionBindResult.mWantsArgs = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue