mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +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
|
@ -3143,7 +3143,7 @@ void BfModule::VisitEmbeddedStatement(BfAstNode* stmt, BfExprEvaluator* exprEval
|
|||
if ((flags & BfEmbeddedStatementFlags_Unscoped) != 0)
|
||||
{
|
||||
SetAndRestoreValue<BfExprEvaluator*> prevExprEvaluator(mCurMethodState->mCurScope->mExprEvaluator, exprEvaluator);
|
||||
|
||||
SetAndRestoreValue<bool> prevAllowReturn(mCurMethodState->mDisableReturns, true);
|
||||
VisitCodeBlock(block);
|
||||
}
|
||||
else if (mCurMethodState != NULL)
|
||||
|
@ -4983,9 +4983,14 @@ static int gRetIdx = 0;
|
|||
|
||||
void BfModule::Visit(BfReturnStatement* returnStmt)
|
||||
{
|
||||
if (mCurMethodInstance == NULL)
|
||||
if ((mCurMethodInstance == NULL) || (mCurMethodState->mDisableReturns))
|
||||
{
|
||||
Fail("Unexpected return", returnStmt);
|
||||
if (returnStmt->mExpression != NULL)
|
||||
{
|
||||
BfExprEvaluator exprEvaluator(this);
|
||||
CreateValueFromExpression(exprEvaluator, returnStmt->mExpression);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue