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

Moved scope of 'if (Call(var X))' arguments into the if parent's scope

This commit is contained in:
Brian Fiete 2020-09-21 17:53:22 -07:00
parent 5b8d2ffee2
commit 965e2e2930
4 changed files with 79 additions and 0 deletions

View file

@ -6561,6 +6561,13 @@ BfTypedValue BfExprEvaluator::ResolveArgValue(BfResolvedArg& resolvedArg, BfType
CheckVariableDeclaration(resolvedArg.mExpression, false, false, false);
argValue = BfTypedValue(localVar->mAddr, mModule->CreateRefType(variableType, BfRefType::RefKind_Out));
auto curScope = mModule->mCurMethodState->mCurScope;
if (curScope->mScopeKind == BfScopeKind_StatementTarget)
{
// Move this variable into the parent scope
curScope->mLocalVarStart = (int)mModule->mCurMethodState->mLocals.size();
}
}
return argValue;
}
@ -18589,6 +18596,8 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
{
if (mModule->mCurMethodState->mDeferredLocalAssignData != NULL)
mModule->mCurMethodState->mDeferredLocalAssignData->BreakExtendChain();
if (mModule->mCurMethodState->mCurScope->mScopeKind == BfScopeKind_StatementTarget)
mModule->mCurMethodState->mCurScope->mScopeKind = BfScopeKind_StatementTarget_Conditional;
bool isAnd = binaryOp == BfBinaryOp_ConditionalAnd;