mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +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)
|
if (mCurMethodInstance != NULL)
|
||||||
mCurMethodInstance->mHasFailed = true;
|
mCurMethodInstance->mHasFailed = true;
|
||||||
|
|
||||||
|
@ -16617,6 +16623,8 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr
|
||||||
appendAllocVisitor.mModule = this;
|
appendAllocVisitor.mModule = this;
|
||||||
|
|
||||||
appendAllocVisitor.VisitChild(methodDecl->mBody);
|
appendAllocVisitor.VisitChild(methodDecl->mBody);
|
||||||
|
if (constResolveState.mFailed)
|
||||||
|
appendAllocVisitor.mFailed = true;
|
||||||
if (!appendAllocVisitor.mFailed)
|
if (!appendAllocVisitor.mFailed)
|
||||||
constValue = appendAllocVisitor.mConstAccum;
|
constValue = appendAllocVisitor.mConstAccum;
|
||||||
if (isFirstRun)
|
if (isFirstRun)
|
||||||
|
|
|
@ -921,12 +921,14 @@ public:
|
||||||
BfMethodInstance* mMethodInstance;
|
BfMethodInstance* mMethodInstance;
|
||||||
BfConstResolveState* mPrevConstResolveState;
|
BfConstResolveState* mPrevConstResolveState;
|
||||||
bool mInCalcAppend;
|
bool mInCalcAppend;
|
||||||
|
bool mFailed;
|
||||||
|
|
||||||
BfConstResolveState()
|
BfConstResolveState()
|
||||||
{
|
{
|
||||||
mMethodInstance = NULL;
|
mMethodInstance = NULL;
|
||||||
mPrevConstResolveState = NULL;
|
mPrevConstResolveState = NULL;
|
||||||
mInCalcAppend = false;
|
mInCalcAppend = false;
|
||||||
|
mFailed = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue