1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

'not case' expression, case variable scope change

This commit is contained in:
Brian Fiete 2025-02-22 09:56:39 -08:00
parent 471897a150
commit 5feb0c044b
15 changed files with 133 additions and 19 deletions

View file

@ -2441,6 +2441,13 @@ void BfModule::HandleCaseEnumMatch_Tuple(BfTypedValue tupleVal, const BfSizedArr
auto localVar = HandleVariableDeclaration(varDecl, tupleElement, false, true);
localVar->mReadFromId = 0; // Don't give usage errors for binds
auto curScope = mCurMethodState->mCurScope;
if (curScope->mScopeKind == BfScopeKind_StatementTarget)
{
// Move this variable into the parent scope
curScope->mLocalVarStart = localVar->mLocalVarIdx + 1;
}
continue;
}
@ -2464,6 +2471,12 @@ void BfModule::HandleCaseEnumMatch_Tuple(BfTypedValue tupleVal, const BfSizedArr
auto localVar = HandleVariableDeclaration(resolvedType, binOpExpr->mRight, tupleElement, false, true);
localVar->mReadFromId = 0; // Don't give usage errors for binds
auto curScope = mCurMethodState->mCurScope;
if (curScope->mScopeKind == BfScopeKind_StatementTarget)
{
// Move this variable into the parent scope
curScope->mLocalVarStart = localVar->mLocalVarIdx + 1;
}
continue;
}
}