mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 08:30:25 +02:00
Fixed issue with return from unscoped block in string interpolation
This commit is contained in:
parent
8cccec20fa
commit
c2a2cf221a
2 changed files with 11 additions and 4 deletions
|
@ -1034,6 +1034,7 @@ public:
|
||||||
bool mNoBind;
|
bool mNoBind;
|
||||||
bool mInConditionalBlock; // IE: RHS of ((A) && (B)), indicates an allocation in 'B' won't be dominated by a dtor, for example
|
bool mInConditionalBlock; // IE: RHS of ((A) && (B)), indicates an allocation in 'B' won't be dominated by a dtor, for example
|
||||||
bool mAllowUinitReads;
|
bool mAllowUinitReads;
|
||||||
|
bool mDisableReturns;
|
||||||
bool mCancelledDeferredCall;
|
bool mCancelledDeferredCall;
|
||||||
bool mNoObjectAccessChecks;
|
bool mNoObjectAccessChecks;
|
||||||
bool mHadIgnoredError;
|
bool mHadIgnoredError;
|
||||||
|
@ -1073,6 +1074,7 @@ public:
|
||||||
mDisableChecks = false;
|
mDisableChecks = false;
|
||||||
mInConditionalBlock = false;
|
mInConditionalBlock = false;
|
||||||
mAllowUinitReads = false;
|
mAllowUinitReads = false;
|
||||||
|
mDisableReturns = false;
|
||||||
mCancelledDeferredCall = false;
|
mCancelledDeferredCall = false;
|
||||||
mNoObjectAccessChecks = false;
|
mNoObjectAccessChecks = false;
|
||||||
mInDeferredBlock = false;
|
mInDeferredBlock = false;
|
||||||
|
|
|
@ -3143,7 +3143,7 @@ void BfModule::VisitEmbeddedStatement(BfAstNode* stmt, BfExprEvaluator* exprEval
|
||||||
if ((flags & BfEmbeddedStatementFlags_Unscoped) != 0)
|
if ((flags & BfEmbeddedStatementFlags_Unscoped) != 0)
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<BfExprEvaluator*> prevExprEvaluator(mCurMethodState->mCurScope->mExprEvaluator, exprEvaluator);
|
SetAndRestoreValue<BfExprEvaluator*> prevExprEvaluator(mCurMethodState->mCurScope->mExprEvaluator, exprEvaluator);
|
||||||
|
SetAndRestoreValue<bool> prevAllowReturn(mCurMethodState->mDisableReturns, true);
|
||||||
VisitCodeBlock(block);
|
VisitCodeBlock(block);
|
||||||
}
|
}
|
||||||
else if (mCurMethodState != NULL)
|
else if (mCurMethodState != NULL)
|
||||||
|
@ -4983,9 +4983,14 @@ static int gRetIdx = 0;
|
||||||
|
|
||||||
void BfModule::Visit(BfReturnStatement* returnStmt)
|
void BfModule::Visit(BfReturnStatement* returnStmt)
|
||||||
{
|
{
|
||||||
if (mCurMethodInstance == NULL)
|
if ((mCurMethodInstance == NULL) || (mCurMethodState->mDisableReturns))
|
||||||
{
|
{
|
||||||
Fail("Unexpected return", returnStmt);
|
Fail("Unexpected return", returnStmt);
|
||||||
|
if (returnStmt->mExpression != NULL)
|
||||||
|
{
|
||||||
|
BfExprEvaluator exprEvaluator(this);
|
||||||
|
CreateValueFromExpression(exprEvaluator, returnStmt->mExpression);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue