mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 22:34:09 +02:00
Fixed dyn scope detection in null conditional
This commit is contained in:
parent
e018c08134
commit
b10edc6f0a
1 changed files with 21 additions and 7 deletions
|
@ -3020,16 +3020,24 @@ void BfExprEvaluator::Evaluate(BfAstNode* astNode, bool propogateNullConditional
|
||||||
// ParenthesizedExpression breaks null conditional chain
|
// ParenthesizedExpression breaks null conditional chain
|
||||||
if (astNode->IsExact<BfParenthesizedExpression>())
|
if (astNode->IsExact<BfParenthesizedExpression>())
|
||||||
propogateNullConditional = false;
|
propogateNullConditional = false;
|
||||||
|
|
||||||
|
bool scopeWasConditional = false;
|
||||||
|
|
||||||
BfPendingNullConditional* pendingNullCond = NULL;
|
BfPendingNullConditional* pendingNullCond = NULL;
|
||||||
|
mInsidePendingNullable = false;
|
||||||
if (mModule->mCurMethodState != NULL)
|
if (mModule->mCurMethodState != NULL)
|
||||||
{
|
{
|
||||||
|
scopeWasConditional = mModule->mCurMethodState->mCurScope->mIsConditional;
|
||||||
pendingNullCond = mModule->mCurMethodState->mPendingNullConditional;
|
pendingNullCond = mModule->mCurMethodState->mPendingNullConditional;
|
||||||
if (!propogateNullConditional)
|
if (!propogateNullConditional)
|
||||||
mModule->mCurMethodState->mPendingNullConditional = NULL;
|
mModule->mCurMethodState->mPendingNullConditional = NULL;
|
||||||
}
|
if (pendingNullCond != NULL)
|
||||||
mInsidePendingNullable = pendingNullCond != NULL;
|
{
|
||||||
|
mInsidePendingNullable = true;
|
||||||
|
mModule->mCurMethodState->mCurScope->mIsConditional = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
astNode->Accept(this);
|
astNode->Accept(this);
|
||||||
GetResult();
|
GetResult();
|
||||||
|
|
||||||
|
@ -3042,11 +3050,17 @@ void BfExprEvaluator::Evaluate(BfAstNode* astNode, bool propogateNullConditional
|
||||||
if ((mBfEvalExprFlags & BfEvalExprFlags_AllowIntUnknown) == 0)
|
if ((mBfEvalExprFlags & BfEvalExprFlags_AllowIntUnknown) == 0)
|
||||||
mModule->FixIntUnknown(mResult);
|
mModule->FixIntUnknown(mResult);
|
||||||
|
|
||||||
if ((!propogateNullConditional) && (mModule->mCurMethodState != NULL))
|
if (mModule->mCurMethodState != NULL)
|
||||||
{
|
{
|
||||||
if (mModule->mCurMethodState->mPendingNullConditional != NULL)
|
if (mInsidePendingNullable)
|
||||||
mResult = mModule->FlushNullConditional(mResult, ignoreNullConditional);
|
mModule->mCurMethodState->mCurScope->mIsConditional = scopeWasConditional;
|
||||||
mModule->mCurMethodState->mPendingNullConditional = pendingNullCond;
|
|
||||||
|
if (!propogateNullConditional)
|
||||||
|
{
|
||||||
|
if (mModule->mCurMethodState->mPendingNullConditional != NULL)
|
||||||
|
mResult = mModule->FlushNullConditional(mResult, ignoreNullConditional);
|
||||||
|
mModule->mCurMethodState->mPendingNullConditional = pendingNullCond;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue