mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fix for early unconditional return in dtor
This commit is contained in:
parent
6df69a7d95
commit
ac8d5cf014
1 changed files with 5 additions and 5 deletions
|
@ -15049,13 +15049,9 @@ void BfModule::EmitReturn(const BfTypedValue& val)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EmitDeferredScopeCalls(false, NULL);
|
EmitDeferredScopeCalls(false, NULL);
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
if (mCurMethodInstance->mReturnType->IsValuelessType())
|
BF_ASSERT(mBfIRBuilder->mIgnoreWrites);
|
||||||
mBfIRBuilder->CreateRetVoid();
|
|
||||||
else
|
|
||||||
mBfIRBuilder->CreateRet(val.mValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15803,6 +15799,10 @@ void BfModule::EmitDtorBody()
|
||||||
if (auto bodyBlock = BfNodeDynCast<BfBlock>(methodDef->mBody))
|
if (auto bodyBlock = BfNodeDynCast<BfBlock>(methodDef->mBody))
|
||||||
{
|
{
|
||||||
VisitEmbeddedStatement(bodyBlock);
|
VisitEmbeddedStatement(bodyBlock);
|
||||||
|
|
||||||
|
// We don't have an exit block and no return was actually emitted, so we set this to false to ensure a proper ret emission later
|
||||||
|
mCurMethodState->mHadReturn = false;
|
||||||
|
|
||||||
if (bodyBlock->mCloseBrace != NULL)
|
if (bodyBlock->mCloseBrace != NULL)
|
||||||
{
|
{
|
||||||
UpdateSrcPos(bodyBlock->mCloseBrace);
|
UpdateSrcPos(bodyBlock->mCloseBrace);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue