mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed error handling in const append calc
This commit is contained in:
parent
0d5b209a14
commit
9d079dfcb6
2 changed files with 10 additions and 0 deletions
|
@ -3113,6 +3113,12 @@ BfError* BfModule::Fail(const StringImpl& error, BfAstNode* refNode, bool isPers
|
|||
}
|
||||
}
|
||||
|
||||
if ((mCurMethodState != NULL) && (mCurMethodState->mConstResolveState != NULL) && (mCurMethodState->mConstResolveState->mInCalcAppend))
|
||||
{
|
||||
mCurMethodState->mConstResolveState->mFailed = true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mCurMethodInstance != NULL)
|
||||
mCurMethodInstance->mHasFailed = true;
|
||||
|
||||
|
@ -16617,6 +16623,8 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr
|
|||
appendAllocVisitor.mModule = this;
|
||||
|
||||
appendAllocVisitor.VisitChild(methodDecl->mBody);
|
||||
if (constResolveState.mFailed)
|
||||
appendAllocVisitor.mFailed = true;
|
||||
if (!appendAllocVisitor.mFailed)
|
||||
constValue = appendAllocVisitor.mConstAccum;
|
||||
if (isFirstRun)
|
||||
|
|
|
@ -921,12 +921,14 @@ public:
|
|||
BfMethodInstance* mMethodInstance;
|
||||
BfConstResolveState* mPrevConstResolveState;
|
||||
bool mInCalcAppend;
|
||||
bool mFailed;
|
||||
|
||||
BfConstResolveState()
|
||||
{
|
||||
mMethodInstance = NULL;
|
||||
mPrevConstResolveState = NULL;
|
||||
mInCalcAppend = false;
|
||||
mFailed = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue