mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed error/warning bool interference in AddErrorContext
This commit is contained in:
parent
efbdc33622
commit
be6e7edf02
3 changed files with 20 additions and 7 deletions
|
@ -2847,7 +2847,7 @@ bool BfModule::IsSkippingExtraResolveChecks()
|
||||||
return mCompiler->IsSkippingExtraResolveChecks();
|
return mCompiler->IsSkippingExtraResolveChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfModule::AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool& isWhileSpecializing)
|
bool BfModule::AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool& isWhileSpecializing, bool isWarning)
|
||||||
{
|
{
|
||||||
bool isWhileSpecializingMethod = false;
|
bool isWhileSpecializingMethod = false;
|
||||||
if ((mIsSpecialModule) && (mModuleName == "vdata"))
|
if ((mIsSpecialModule) && (mModuleName == "vdata"))
|
||||||
|
@ -2867,6 +2867,9 @@ bool BfModule::AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool
|
||||||
auto _CheckMethodInstance = [&](BfMethodInstance* methodInstance)
|
auto _CheckMethodInstance = [&](BfMethodInstance* methodInstance)
|
||||||
{
|
{
|
||||||
// Propogate the fail all the way to the main method (assuming we're in a local method or lambda)
|
// Propogate the fail all the way to the main method (assuming we're in a local method or lambda)
|
||||||
|
if (isWarning)
|
||||||
|
methodInstance->mHasWarning = true;
|
||||||
|
else
|
||||||
methodInstance->mHasFailed = true;
|
methodInstance->mHasFailed = true;
|
||||||
|
|
||||||
bool isSpecializedMethod = ((methodInstance != NULL) && (!methodInstance->mIsUnspecialized) && (methodInstance->mMethodInfoEx != NULL) && (methodInstance->mMethodInfoEx->mMethodGenericArguments.size() != 0));
|
bool isSpecializedMethod = ((methodInstance != NULL) && (!methodInstance->mIsUnspecialized) && (methodInstance->mMethodInfoEx != NULL) && (methodInstance->mMethodInfoEx->mMethodGenericArguments.size() != 0));
|
||||||
|
@ -2880,11 +2883,19 @@ bool BfModule::AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool
|
||||||
BF_ASSERT(methodInstance->mMethodDef->mIsLocalMethod);
|
BF_ASSERT(methodInstance->mMethodDef->mIsLocalMethod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (isWarning)
|
||||||
|
{
|
||||||
|
if (unspecializedMethod->mHasWarning)
|
||||||
|
return false; // At least SOME error has already been reported
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (unspecializedMethod->mHasFailed)
|
if (unspecializedMethod->mHasFailed)
|
||||||
return false; // At least SOME error has already been reported
|
return false; // At least SOME error has already been reported
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isSpecializedMethod)
|
if (isSpecializedMethod)
|
||||||
{
|
{
|
||||||
|
@ -3000,7 +3011,7 @@ BfError* BfModule::Fail(const StringImpl& error, BfAstNode* refNode, bool isPers
|
||||||
|
|
||||||
String errorString = error;
|
String errorString = error;
|
||||||
bool isWhileSpecializing = false;
|
bool isWhileSpecializing = false;
|
||||||
if (!AddErrorContext(errorString, refNode, isWhileSpecializing))
|
if (!AddErrorContext(errorString, refNode, isWhileSpecializing, false))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
BfError* bfError = NULL;
|
BfError* bfError = NULL;
|
||||||
|
@ -3145,7 +3156,7 @@ BfError* BfModule::Warn(int warningNum, const StringImpl& warning, BfAstNode* re
|
||||||
|
|
||||||
String warningString = warning;
|
String warningString = warning;
|
||||||
bool isWhileSpecializing = false;
|
bool isWhileSpecializing = false;
|
||||||
if (!AddErrorContext(warningString, refNode, isWhileSpecializing))
|
if (!AddErrorContext(warningString, refNode, isWhileSpecializing, true))
|
||||||
return NULL;
|
return NULL;
|
||||||
bool deferWarning = isWhileSpecializing;
|
bool deferWarning = isWhileSpecializing;
|
||||||
|
|
||||||
|
|
|
@ -1528,7 +1528,7 @@ public:
|
||||||
void SetFail();
|
void SetFail();
|
||||||
void VerifyOnDemandMethods();
|
void VerifyOnDemandMethods();
|
||||||
bool IsSkippingExtraResolveChecks();
|
bool IsSkippingExtraResolveChecks();
|
||||||
bool AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool& isWhileSpecializing);
|
bool AddErrorContext(StringImpl& errorString, BfAstNode* refNode, bool& isWhileSpecializing, bool isWarning);
|
||||||
BfError* Fail(const StringImpl& error, BfAstNode* refNode = NULL, bool isPersistent = false, bool deferError = false);
|
BfError* Fail(const StringImpl& error, BfAstNode* refNode = NULL, bool isPersistent = false, bool deferError = false);
|
||||||
BfError* FailInternal(const StringImpl& error, BfAstNode* refNode = NULL);
|
BfError* FailInternal(const StringImpl& error, BfAstNode* refNode = NULL);
|
||||||
BfError* FailAfter(const StringImpl& error, BfAstNode* refNode);
|
BfError* FailAfter(const StringImpl& error, BfAstNode* refNode);
|
||||||
|
|
|
@ -839,6 +839,7 @@ public:
|
||||||
bool mHasBeenDeclared:1;
|
bool mHasBeenDeclared:1;
|
||||||
bool mHasBeenProcessed:1;
|
bool mHasBeenProcessed:1;
|
||||||
bool mHasFailed:1;
|
bool mHasFailed:1;
|
||||||
|
bool mHasWarning:1;
|
||||||
bool mFailedConstraints:1;
|
bool mFailedConstraints:1;
|
||||||
bool mMangleWithIdx:1;
|
bool mMangleWithIdx:1;
|
||||||
bool mHadGenericDelegateParams:1;
|
bool mHadGenericDelegateParams:1;
|
||||||
|
@ -880,6 +881,7 @@ public:
|
||||||
mHasBeenDeclared = false;
|
mHasBeenDeclared = false;
|
||||||
mHasBeenProcessed = false;
|
mHasBeenProcessed = false;
|
||||||
mHasFailed = false;
|
mHasFailed = false;
|
||||||
|
mHasWarning = false;
|
||||||
mFailedConstraints = false;
|
mFailedConstraints = false;
|
||||||
mMangleWithIdx = false;
|
mMangleWithIdx = false;
|
||||||
mHadGenericDelegateParams = false;
|
mHadGenericDelegateParams = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue