mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Made custom allocators work with pointers to structs, give proper errors
This commit is contained in:
parent
bea4fe007a
commit
392b2e0b6c
1 changed files with 11 additions and 1 deletions
|
@ -8375,7 +8375,17 @@ BfIRValue BfModule::AllocBytes(BfAstNode* refNode, const BfAllocTarget& allocTar
|
|||
else if (allocTarget.mCustomAllocator)
|
||||
{
|
||||
auto customTypeInst = allocTarget.mCustomAllocator.mType->ToTypeInstance();
|
||||
if (customTypeInst != NULL)
|
||||
if (customTypeInst == NULL)
|
||||
{
|
||||
if (allocTarget.mCustomAllocator.mType->IsStructPtr())
|
||||
customTypeInst = allocTarget.mCustomAllocator.mType->GetUnderlyingType()->ToTypeInstance();
|
||||
}
|
||||
|
||||
if (customTypeInst == NULL)
|
||||
{
|
||||
Fail(StrFormat("Type '%s' cannot be used as a custom allocator", TypeToString(allocTarget.mCustomAllocator.mType).c_str()), refNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
BfTypedValueExpression typeValueExpr;
|
||||
String allocMethodName = "Alloc";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue