mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Initializer expressions
This commit is contained in:
parent
f6e31e4976
commit
229a5aa5c5
17 changed files with 305 additions and 18 deletions
|
@ -3091,8 +3091,7 @@ void BfModule::VisitEmbeddedStatement(BfAstNode* stmt, BfExprEvaluator* exprEval
|
|||
if (mCurMethodState != NULL)
|
||||
{
|
||||
bool isIgnore = mBfIRBuilder->mIgnoreWrites;
|
||||
|
||||
SetAndRestoreValue<bool> prevEmbedded(mCurMethodState->mIsEmbedded, block == NULL);
|
||||
|
||||
mCurMethodState->mInHeadScope = false;
|
||||
|
||||
BfScopeData scopeData;
|
||||
|
@ -3122,7 +3121,14 @@ void BfModule::VisitEmbeddedStatement(BfAstNode* stmt, BfExprEvaluator* exprEval
|
|||
VisitCodeBlock(block);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auto varDecl = BfNodeDynCast<BfVariableDeclaration>(stmt))
|
||||
{
|
||||
Fail("Variable declarations must be wrapped in a block statement", varDecl);
|
||||
}
|
||||
|
||||
VisitChild(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
if ((block != NULL) && (closeBrace != NULL))
|
||||
|
@ -3720,9 +3726,6 @@ void BfModule::Visit(BfVariableDeclaration* varDecl)
|
|||
|
||||
UpdateSrcPos(varDecl);
|
||||
|
||||
if (mCurMethodState->mIsEmbedded)
|
||||
Fail("Variable declarations must be wrapped in a block statement", varDecl);
|
||||
|
||||
BfTupleExpression* tupleVariableDeclaration = BfNodeDynCast<BfTupleExpression>(varDecl->mNameNode);
|
||||
if (tupleVariableDeclaration != NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue