mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed fatalerror reentrancy, fixed valueless equals method
This commit is contained in:
parent
2387bd6be9
commit
e912bb955b
1 changed files with 30 additions and 4 deletions
|
@ -3004,8 +3004,20 @@ void BfModule::CheckRangeError(BfType* type, BfAstNode* refNode)
|
||||||
Fail(StrFormat("Result out of range for type '%s'", TypeToString(type).c_str()), refNode);
|
Fail(StrFormat("Result out of range for type '%s'", TypeToString(type).c_str()), refNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BfModule::FatalError(const StringImpl& error, const char* file, int line)
|
void BfModule::FatalError(const StringImpl& error, const char* file, int line)
|
||||||
{
|
{
|
||||||
|
static bool sHadFatalError = false;
|
||||||
|
static bool sHadReentrancy = false;
|
||||||
|
|
||||||
|
if (sHadFatalError)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
sHadReentrancy = true;
|
||||||
|
}
|
||||||
|
sHadFatalError = true;
|
||||||
|
|
||||||
String fullError = error;
|
String fullError = error;
|
||||||
|
|
||||||
if (file != NULL)
|
if (file != NULL)
|
||||||
|
@ -3021,6 +3033,9 @@ void BfModule::FatalError(const StringImpl& error, const char* file, int line)
|
||||||
if ((mCurFilePosition.mFileInstance != NULL) && (mCurFilePosition.mFileInstance->mParser != NULL))
|
if ((mCurFilePosition.mFileInstance != NULL) && (mCurFilePosition.mFileInstance->mParser != NULL))
|
||||||
fullError += StrFormat("\nSource Location: %s:%d", mCurFilePosition.mFileInstance->mParser->mFileName.c_str(), mCurFilePosition.mCurLine + 1);
|
fullError += StrFormat("\nSource Location: %s:%d", mCurFilePosition.mFileInstance->mParser->mFileName.c_str(), mCurFilePosition.mCurLine + 1);
|
||||||
|
|
||||||
|
if (sHadReentrancy)
|
||||||
|
fullError += "\nError had reentrancy";
|
||||||
|
|
||||||
BfpSystem_FatalError(fullError.c_str(), "FATAL MODULE ERROR");
|
BfpSystem_FatalError(fullError.c_str(), "FATAL MODULE ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4173,6 +4188,13 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
|
||||||
if (mBfIRBuilder->mIgnoreWrites)
|
if (mBfIRBuilder->mIgnoreWrites)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto boolType = GetPrimitiveType(BfTypeCode_Boolean);
|
||||||
|
if (mCurTypeInstance->IsValuelessType())
|
||||||
|
{
|
||||||
|
mBfIRBuilder->CreateRet(GetDefaultValue(boolType));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mCurTypeInstance->IsTypedPrimitive())
|
if (mCurTypeInstance->IsTypedPrimitive())
|
||||||
{
|
{
|
||||||
BfExprEvaluator exprEvaluator(this);
|
BfExprEvaluator exprEvaluator(this);
|
||||||
|
@ -4201,7 +4223,6 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
|
||||||
mBfIRBuilder->PopulateType(compareTypeInst);
|
mBfIRBuilder->PopulateType(compareTypeInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto boolType = GetPrimitiveType(BfTypeCode_Boolean);
|
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
ClearLifetimeEnds();
|
ClearLifetimeEnds();
|
||||||
|
@ -7584,7 +7605,7 @@ BF_NOINLINE void BfModule::EvaluateWithNewScope(BfExprEvaluator& exprEvaluator,
|
||||||
mCurMethodState->AddScope(&newScope);
|
mCurMethodState->AddScope(&newScope);
|
||||||
NewScopeState();
|
NewScopeState();
|
||||||
exprEvaluator.mBfEvalExprFlags = flags;
|
exprEvaluator.mBfEvalExprFlags = flags;
|
||||||
exprEvaluator.Evaluate(expr, (flags & BfEvalExprFlags_PropogateNullConditional) != 0, (flags & BfEvalExprFlags_IgnoreNullConditional) != 0, true);
|
exprEvaluator.Evaluate(expr, (flags & BfEvalExprFlags_PropogateNullConditional) != 0, (flags & BfEvalExprFlags_IgnoreNullConditional) != 0, (flags & BfEvalExprFlags_AllowSplat) != 0);
|
||||||
RestoreScopeState();
|
RestoreScopeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9314,7 +9335,7 @@ BfMethodInstance* BfModule::GetRawMethodInstanceAtIdx(BfTypeInstance* typeInstan
|
||||||
{
|
{
|
||||||
if (!mCompiler->mIsResolveOnly)
|
if (!mCompiler->mIsResolveOnly)
|
||||||
{
|
{
|
||||||
BF_ASSERT((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl) || (typeInstance->mTypeFailed));
|
BF_ASSERT((methodGroup.mOnDemandKind == BfMethodOnDemandKind_AlwaysInclude) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl) || (typeInstance->mTypeFailed));
|
||||||
if ((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl))
|
if ((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl))
|
||||||
methodGroup.mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
methodGroup.mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
||||||
|
|
||||||
|
@ -16895,6 +16916,11 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HasCompiledOutput())
|
||||||
|
{
|
||||||
|
BF_ASSERT(mIsModuleMutable);
|
||||||
|
}
|
||||||
|
|
||||||
BfMethodInstance* defaultMethodInstance = methodInstance->mMethodInstanceGroup->mDefault;
|
BfMethodInstance* defaultMethodInstance = methodInstance->mMethodInstanceGroup->mDefault;
|
||||||
|
|
||||||
BF_ASSERT(methodInstance->mMethodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_NotSet);
|
BF_ASSERT(methodInstance->mMethodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_NotSet);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue