mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Improved comptime circular data reference issues
This commit is contained in:
parent
910f560380
commit
79e98fe9f7
7 changed files with 161 additions and 25 deletions
|
@ -160,6 +160,7 @@ public:
|
||||||
BfTypeInstance* mCurBaseType;
|
BfTypeInstance* mCurBaseType;
|
||||||
BfTypeReference* mCurAttributeTypeRef;
|
BfTypeReference* mCurAttributeTypeRef;
|
||||||
BfFieldDef* mCurFieldDef;
|
BfFieldDef* mCurFieldDef;
|
||||||
|
BfMethodDef* mCurMethodDef;
|
||||||
BfTypeDef* mCurTypeDef;
|
BfTypeDef* mCurTypeDef;
|
||||||
BfTypeDef* mForceActiveTypeDef;
|
BfTypeDef* mForceActiveTypeDef;
|
||||||
BfProject* mActiveProject;
|
BfProject* mActiveProject;
|
||||||
|
@ -179,6 +180,7 @@ public:
|
||||||
mCurBaseTypeRef = NULL;
|
mCurBaseTypeRef = NULL;
|
||||||
mCurBaseType = NULL;
|
mCurBaseType = NULL;
|
||||||
mCurFieldDef = NULL;
|
mCurFieldDef = NULL;
|
||||||
|
mCurMethodDef = NULL;
|
||||||
mCurAttributeTypeRef = NULL;
|
mCurAttributeTypeRef = NULL;
|
||||||
mCurTypeDef = NULL;
|
mCurTypeDef = NULL;
|
||||||
mForceActiveTypeDef = NULL;
|
mForceActiveTypeDef = NULL;
|
||||||
|
@ -199,6 +201,7 @@ public:
|
||||||
mCurBaseTypeRef = NULL;
|
mCurBaseTypeRef = NULL;
|
||||||
mCurBaseType = NULL;
|
mCurBaseType = NULL;
|
||||||
mCurFieldDef = NULL;
|
mCurFieldDef = NULL;
|
||||||
|
mCurMethodDef = NULL;
|
||||||
mCurAttributeTypeRef = NULL;
|
mCurAttributeTypeRef = NULL;
|
||||||
mCurTypeDef = NULL;
|
mCurTypeDef = NULL;
|
||||||
mForceActiveTypeDef = NULL;
|
mForceActiveTypeDef = NULL;
|
||||||
|
|
|
@ -1183,10 +1183,10 @@ void BfMSMangler::AddTypeStart(MangleContext& mangleContext, StringImpl& name, B
|
||||||
if ((type->IsEnum()) && (type->IsTypedPrimitive()))
|
if ((type->IsEnum()) && (type->IsTypedPrimitive()))
|
||||||
{
|
{
|
||||||
auto unreifiedModule = mangleContext.GetUnreifiedModule();
|
auto unreifiedModule = mangleContext.GetUnreifiedModule();
|
||||||
if (unreifiedModule != NULL)
|
if (type->mDefineState >= BfTypeDefineState_Defined)
|
||||||
unreifiedModule->PopulateType(type, BfPopulateType_Data);
|
{
|
||||||
|
|
||||||
BF_ASSERT(type->mSize >= 0);
|
BF_ASSERT(type->mSize >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
// The enum size is supposed to be encoded, but VC always uses '4'
|
// The enum size is supposed to be encoded, but VC always uses '4'
|
||||||
//name += "W";
|
//name += "W";
|
||||||
|
|
|
@ -24124,12 +24124,19 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
|
|
||||||
BP_ZONE("BfModule::DoMethodDeclaration");
|
BP_ZONE("BfModule::DoMethodDeclaration");
|
||||||
|
|
||||||
|
auto typeInstance = mCurTypeInstance;
|
||||||
|
auto typeDef = typeInstance->mTypeDef;
|
||||||
|
auto methodDef = mCurMethodInstance->mMethodDef;
|
||||||
|
|
||||||
// We could trigger a DoMethodDeclaration from a const resolver or other location, so we reset it here
|
// We could trigger a DoMethodDeclaration from a const resolver or other location, so we reset it here
|
||||||
// to effectively make mIgnoreWrites method-scoped
|
// to effectively make mIgnoreWrites method-scoped
|
||||||
SetAndRestoreValue<bool> prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, mWantsIRIgnoreWrites || mCurMethodInstance->mIsUnspecialized || mCurTypeInstance->mResolvingVarField);
|
SetAndRestoreValue<bool> prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, mWantsIRIgnoreWrites || mCurMethodInstance->mIsUnspecialized || mCurTypeInstance->mResolvingVarField);
|
||||||
SetAndRestoreValue<bool> prevIsCapturingMethodMatchInfo;
|
SetAndRestoreValue<bool> prevIsCapturingMethodMatchInfo;
|
||||||
SetAndRestoreValue<bool> prevAllowLockYield(mContext->mAllowLockYield, false);
|
SetAndRestoreValue<bool> prevAllowLockYield(mContext->mAllowLockYield, false);
|
||||||
BfTypeState typeState(mCurTypeInstance);
|
BfTypeState typeState(mCurTypeInstance);
|
||||||
|
typeState.mPrevState = mContext->mCurTypeState;
|
||||||
|
typeState.mForceActiveTypeDef = methodDef->mDeclaringType;
|
||||||
|
typeState.mCurMethodDef = methodDef;
|
||||||
SetAndRestoreValue<BfTypeState*> prevTypeState(mContext->mCurTypeState, &typeState);
|
SetAndRestoreValue<BfTypeState*> prevTypeState(mContext->mCurTypeState, &typeState);
|
||||||
|
|
||||||
BfModule* resolveModule = mContext->mUnreifiedModule;
|
BfModule* resolveModule = mContext->mUnreifiedModule;
|
||||||
|
@ -24160,10 +24167,6 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
if ((mAwaitingInitFinish) && (!mBfIRBuilder->mIgnoreWrites))
|
if ((mAwaitingInitFinish) && (!mBfIRBuilder->mIgnoreWrites))
|
||||||
FinishInit();
|
FinishInit();
|
||||||
|
|
||||||
auto typeInstance = mCurTypeInstance;
|
|
||||||
auto typeDef = typeInstance->mTypeDef;
|
|
||||||
auto methodDef = mCurMethodInstance->mMethodDef;
|
|
||||||
|
|
||||||
if (methodDef->mName.StartsWith('_'))
|
if (methodDef->mName.StartsWith('_'))
|
||||||
{
|
{
|
||||||
BF_ASSERT(methodDef->mName != "__ASSERTNAME");
|
BF_ASSERT(methodDef->mName != "__ASSERTNAME");
|
||||||
|
|
|
@ -1635,7 +1635,7 @@ public:
|
||||||
BfError* Warn(int warningNum, const StringImpl& warning, BfAstNode* refNode = NULL, bool isPersistent = false, bool showInSpecialized = false);
|
BfError* Warn(int warningNum, const StringImpl& warning, BfAstNode* refNode = NULL, bool isPersistent = false, bool showInSpecialized = false);
|
||||||
void CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstance* methodInstance, BfFieldInstance* fieldInstance, BfCustomAttributes* customAttributes, BfAstNode* targetSrc);
|
void CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstance* methodInstance, BfFieldInstance* fieldInstance, BfCustomAttributes* customAttributes, BfAstNode* targetSrc);
|
||||||
void CheckRangeError(BfType* type, BfAstNode* refNode);
|
void CheckRangeError(BfType* type, BfAstNode* refNode);
|
||||||
bool CheckCircularDataError(bool failTypes = true);
|
bool CheckCircularDataError(bool failTypes = true, bool forceFail = false);
|
||||||
BfFileInstance* GetFileFromNode(BfAstNode* astNode);
|
BfFileInstance* GetFileFromNode(BfAstNode* astNode);
|
||||||
//void UpdateSrcPos(BfAstNode* astNode, bool setDebugLoc = true, int debugLocOffset = 0, bool force = false);
|
//void UpdateSrcPos(BfAstNode* astNode, bool setDebugLoc = true, int debugLocOffset = 0, bool force = false);
|
||||||
void UpdateSrcPos(BfAstNode* astNode, BfSrcPosFlags flags = BfSrcPosFlag_None, int debugLocOffset = 0);
|
void UpdateSrcPos(BfAstNode* astNode, BfSrcPosFlags flags = BfSrcPosFlag_None, int debugLocOffset = 0);
|
||||||
|
|
|
@ -1044,8 +1044,12 @@ void BfModule::TypeFailed(BfTypeInstance* typeInstance)
|
||||||
mHadBuildError = true;
|
mHadBuildError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfModule::CheckCircularDataError(bool failTypes)
|
bool BfModule::CheckCircularDataError(bool failTypes, bool forceFail)
|
||||||
{
|
{
|
||||||
|
// First check to see if the forceFail is necessary
|
||||||
|
if ((forceFail) && (CheckCircularDataError(failTypes, false)))
|
||||||
|
return true;
|
||||||
|
|
||||||
// Find two loops of mCurTypeInstance. Just finding one loop can give some false errors.
|
// Find two loops of mCurTypeInstance. Just finding one loop can give some false errors.
|
||||||
|
|
||||||
BfTypeState* circularTypeStateEnd = NULL;
|
BfTypeState* circularTypeStateEnd = NULL;
|
||||||
|
@ -1055,6 +1059,9 @@ bool BfModule::CheckCircularDataError(bool failTypes)
|
||||||
bool isPreBaseCheck = checkTypeState->mPopulateType == BfPopulateType_Declaration;
|
bool isPreBaseCheck = checkTypeState->mPopulateType == BfPopulateType_Declaration;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
if (forceFail)
|
||||||
|
break;
|
||||||
|
|
||||||
if (checkTypeState == NULL)
|
if (checkTypeState == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1090,7 +1097,9 @@ bool BfModule::CheckCircularDataError(bool failTypes)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hadError = false;
|
bool hadError = false;
|
||||||
checkTypeState = mContext->mCurTypeState->mPrevState;
|
checkTypeState = mContext->mCurTypeState;
|
||||||
|
if (!forceFail)
|
||||||
|
checkTypeState = checkTypeState->mPrevState;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (checkTypeState == NULL)
|
if (checkTypeState == NULL)
|
||||||
|
@ -1106,7 +1115,12 @@ bool BfModule::CheckCircularDataError(bool failTypes)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((checkTypeState->mCurAttributeTypeRef == NULL) && (checkTypeState->mCurBaseTypeRef == NULL) && (checkTypeState->mCurFieldDef == NULL) &&
|
if (forceFail)
|
||||||
|
{
|
||||||
|
// Go all the way through
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
else if ((checkTypeState->mCurAttributeTypeRef == NULL) && (checkTypeState->mCurBaseTypeRef == NULL) && (checkTypeState->mCurFieldDef == NULL) &&
|
||||||
((checkTypeState->mType == NULL) || (checkTypeState->mType->IsTypeInstance())))
|
((checkTypeState->mType == NULL) || (checkTypeState->mType->IsTypeInstance())))
|
||||||
return hadError;
|
return hadError;
|
||||||
|
|
||||||
|
@ -1130,6 +1144,11 @@ bool BfModule::CheckCircularDataError(bool failTypes)
|
||||||
Fail(StrFormat("Field '%s.%s' causes a data cycle", TypeToString(checkTypeState->mType).c_str(), checkTypeState->mCurFieldDef->mName.c_str()),
|
Fail(StrFormat("Field '%s.%s' causes a data cycle", TypeToString(checkTypeState->mType).c_str(), checkTypeState->mCurFieldDef->mName.c_str()),
|
||||||
checkTypeState->mCurFieldDef->mTypeRef, true);
|
checkTypeState->mCurFieldDef->mTypeRef, true);
|
||||||
}
|
}
|
||||||
|
else if ((checkTypeState->mCurMethodDef != NULL) && (checkTypeState->mCurMethodDef->mMethodDeclaration != NULL))
|
||||||
|
{
|
||||||
|
Fail(StrFormat("Method '%s.%s' causes a data cycle", TypeToString(checkTypeState->mType).c_str(), checkTypeState->mCurMethodDef->mName.c_str()),
|
||||||
|
checkTypeState->mCurMethodDef->GetRefNode(), true);
|
||||||
|
}
|
||||||
else if (checkTypeState->mCurFieldDef != NULL)
|
else if (checkTypeState->mCurFieldDef != NULL)
|
||||||
{
|
{
|
||||||
BfAstNode* refNode = checkTypeState->mCurFieldDef->GetRefNode();
|
BfAstNode* refNode = checkTypeState->mCurFieldDef->GetRefNode();
|
||||||
|
@ -2838,6 +2857,11 @@ void BfModule::ExecuteCEOnCompile(CeEmitContext* ceEmitContext, BfTypeInstance*
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeInstance->mTypeDef->mName->ToString() == "AssetType")
|
||||||
|
{
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
|
||||||
SetAndRestoreValue<CeEmitContext*> prevEmitContext(mCompiler->mCeMachine->mCurEmitContext);
|
SetAndRestoreValue<CeEmitContext*> prevEmitContext(mCompiler->mCeMachine->mCurEmitContext);
|
||||||
if (onCompileKind == BfCEOnCompileKind_TypeInit)
|
if (onCompileKind == BfCEOnCompileKind_TypeInit)
|
||||||
{
|
{
|
||||||
|
@ -5217,18 +5241,77 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
if ((foundTypeCount >= 2) || (typeInstance->mTypeDef->IsEmitted()))
|
if ((foundTypeCount >= 2) || (typeInstance->mTypeDef->IsEmitted()))
|
||||||
{
|
{
|
||||||
String error = "OnCompile const evaluation creates a data dependency during TypeInit";
|
String error = "OnCompile const evaluation creates a data dependency during TypeInit";
|
||||||
if (mCompiler->mCeMachine->mCurBuilder != NULL)
|
|
||||||
{
|
|
||||||
error += StrFormat(" during const-eval generation of '%s'", MethodToString(mCompiler->mCeMachine->mCurBuilder->mCeFunction->mMethodInstance).c_str());
|
// if (mCompiler->mCeMachine->mCurBuilder != NULL)
|
||||||
}
|
// {
|
||||||
|
// error += StrFormat(" during const-eval generation of '%s'", MethodToString(mCompiler->mCeMachine->mCurBuilder->mCeFunction->mMethodInstance).c_str());
|
||||||
|
// }
|
||||||
|
|
||||||
|
BfError* bfError = NULL;
|
||||||
|
|
||||||
auto refNode = typeDef->GetRefNode();
|
auto refNode = typeDef->GetRefNode();
|
||||||
Fail(error, refNode);
|
//Fail(error, refNode);
|
||||||
|
mCompiler->mCeMachine->FailCurrent(this, error, refNode);
|
||||||
|
|
||||||
if ((mCompiler->mCeMachine->mCurContext != NULL) && (mCompiler->mCeMachine->mCurContext->mCurFrame != NULL))
|
if ((mCompiler->mCeMachine->mCurContext != NULL) && (mCompiler->mCeMachine->mCurContext->mCurFrame != NULL))
|
||||||
mCompiler->mCeMachine->mCurContext->Fail(*mCompiler->mCeMachine->mCurContext->mCurFrame, error);
|
bfError = mCompiler->mCeMachine->mCurContext->Fail(*mCompiler->mCeMachine->mCurContext->mCurFrame, error);
|
||||||
else if (mCompiler->mCeMachine->mCurContext != NULL)
|
else if (mCompiler->mCeMachine->mCurContext != NULL)
|
||||||
mCompiler->mCeMachine->mCurContext->Fail(error);
|
bfError = mCompiler->mCeMachine->mCurContext->Fail(error);
|
||||||
tryCE = false;
|
tryCE = false;
|
||||||
|
|
||||||
|
if (bfError != NULL)
|
||||||
|
{
|
||||||
|
auto passInstance = mCompiler->mPassInstance;
|
||||||
|
|
||||||
|
int foundTypeCount = 0;
|
||||||
|
auto typeState = mContext->mCurTypeState;
|
||||||
|
while (typeState != NULL)
|
||||||
|
{
|
||||||
|
if (typeState->mCurAttributeTypeRef != NULL)
|
||||||
|
{
|
||||||
|
passInstance->MoreInfo(StrFormat("Attribute type '%s' causes a data cycle", BfTypeUtils::TypeToString(typeState->mCurAttributeTypeRef).c_str()), typeState->mCurAttributeTypeRef);
|
||||||
|
}
|
||||||
|
else if (typeState->mCurBaseTypeRef != NULL)
|
||||||
|
{
|
||||||
|
passInstance->MoreInfo(StrFormat("Base type '%s' causes a data cycle", BfTypeUtils::TypeToString(typeState->mCurBaseTypeRef).c_str()), typeState->mCurBaseTypeRef);
|
||||||
|
}
|
||||||
|
else if ((typeState->mCurFieldDef != NULL) && (typeState->mCurFieldDef->mFieldDeclaration != NULL))
|
||||||
|
{
|
||||||
|
passInstance->MoreInfo(StrFormat("Field '%s.%s' causes a data cycle", TypeToString(typeState->mType).c_str(), typeState->mCurFieldDef->mName.c_str()),
|
||||||
|
typeState->mCurFieldDef->mTypeRef);
|
||||||
|
}
|
||||||
|
else if ((typeState->mCurMethodDef != NULL) && (typeState->mCurMethodDef->mMethodDeclaration != NULL))
|
||||||
|
{
|
||||||
|
passInstance->MoreInfo(StrFormat("Method '%s.%s' causes a data cycle", TypeToString(typeState->mType).c_str(), typeState->mCurMethodDef->mName.c_str()),
|
||||||
|
typeState->mCurMethodDef->GetRefNode());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BfAstNode* refNode = NULL;
|
||||||
|
if (typeState->mCurTypeDef != NULL)
|
||||||
|
refNode = typeState->mCurTypeDef->GetRefNode();
|
||||||
|
passInstance->MoreInfo(StrFormat("Type '%s' causes a data cycle", TypeToString(typeState->mType).c_str()), refNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeState->mType == typeInstance)
|
||||||
|
{
|
||||||
|
foundTypeCount++;
|
||||||
|
if (foundTypeCount == 2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
typeState = typeState->mPrevState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((typeInstance->mDefineState == BfTypeDefineState_CETypeInit) && (tryCE))
|
||||||
|
{
|
||||||
|
if (!CheckCircularDataError())
|
||||||
|
{
|
||||||
|
Fail(StrFormat("Unexpected comptime circular data error detected in type '%s'", TypeToString(typeInstance).c_str()), typeDef->GetRefNode());
|
||||||
|
CheckCircularDataError(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3587,6 +3587,7 @@ CeContext::CeContext()
|
||||||
mReflectTypeIdOffset = -1;
|
mReflectTypeIdOffset = -1;
|
||||||
mExecuteId = -1;
|
mExecuteId = -1;
|
||||||
mStackSize = -1;
|
mStackSize = -1;
|
||||||
|
mRecursiveDepth = -1;
|
||||||
|
|
||||||
mCurCallSource = NULL;
|
mCurCallSource = NULL;
|
||||||
mHeap = new ContiguousHeap();
|
mHeap = new ContiguousHeap();
|
||||||
|
@ -9414,6 +9415,7 @@ CeMachine::CeMachine(BfCompiler* compiler)
|
||||||
mCurContext = NULL;
|
mCurContext = NULL;
|
||||||
mCurCallSource = NULL;
|
mCurCallSource = NULL;
|
||||||
mExecuteId = -1;
|
mExecuteId = -1;
|
||||||
|
mCurRecursiveDepth = 0;
|
||||||
|
|
||||||
mCurFunctionId = 0;
|
mCurFunctionId = 0;
|
||||||
mRevisionExecuteTime = 0;
|
mRevisionExecuteTime = 0;
|
||||||
|
@ -10309,6 +10311,8 @@ void CeMachine::PrepareFunction(CeFunction* ceFunction, CeBuilder* parentBuilder
|
||||||
ceBuilder.mPtrSize = mCeModule->mCompiler->mSystem->mPtrSize;
|
ceBuilder.mPtrSize = mCeModule->mCompiler->mSystem->mPtrSize;
|
||||||
ceBuilder.mCeMachine = this;
|
ceBuilder.mCeMachine = this;
|
||||||
ceBuilder.mCeFunction = ceFunction;
|
ceBuilder.mCeFunction = ceFunction;
|
||||||
|
SetAndRestoreValue<int> prevRecursiveDepth(mCurRecursiveDepth, mCurRecursiveDepth + 1);
|
||||||
|
ceBuilder.mRecursiveDepth = mCurRecursiveDepth;
|
||||||
ceBuilder.Build();
|
ceBuilder.Build();
|
||||||
|
|
||||||
ceFunction->mInitializeState = CeFunction::InitializeState_Initialized;
|
ceFunction->mInitializeState = CeFunction::InitializeState_Initialized;
|
||||||
|
@ -10600,7 +10604,43 @@ void CeMachine::ReleaseContext(CeContext* ceContext)
|
||||||
BfTypedValue CeMachine::Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType)
|
BfTypedValue CeMachine::Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType)
|
||||||
{
|
{
|
||||||
auto ceContext = AllocContext();
|
auto ceContext = AllocContext();
|
||||||
|
SetAndRestoreValue<int> prevRecursiveDepth(mCurRecursiveDepth, mCurRecursiveDepth + 1);
|
||||||
|
ceContext->mRecursiveDepth = mCurRecursiveDepth;
|
||||||
auto result = ceContext->Call(callSource, module, methodInstance, args, flags, expectingType);
|
auto result = ceContext->Call(callSource, module, methodInstance, args, flags, expectingType);
|
||||||
ReleaseContext(ceContext);
|
ReleaseContext(ceContext);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BfError* CeMachine::FailCurrent(BfModule* srcModule, const StringImpl& error, BfAstNode* refNode)
|
||||||
|
{
|
||||||
|
BfError* bfError = NULL;
|
||||||
|
|
||||||
|
if ((mCurBuilder != NULL) &&
|
||||||
|
((mCurContext != NULL) || (mCurBuilder->mRecursiveDepth > mCurContext->mRecursiveDepth)))
|
||||||
|
{
|
||||||
|
String useError = error;
|
||||||
|
useError += StrFormat(" during const-eval generation of '%s'", srcModule->MethodToString(mCurBuilder->mCeFunction->mMethodInstance).c_str());
|
||||||
|
bfError = srcModule->Fail(error, refNode);
|
||||||
|
|
||||||
|
if (bfError != NULL)
|
||||||
|
{
|
||||||
|
auto filePos = mCurBuilder->mCeMachine->mCeModule->mCurFilePosition;
|
||||||
|
auto parser = filePos.mFileInstance->mParser;
|
||||||
|
if (parser != NULL)
|
||||||
|
{
|
||||||
|
srcModule->mCompiler->mPassInstance->MoreInfoAt(
|
||||||
|
StrFormat("See comptime method '%s' processing location", srcModule->MethodToString(mCurBuilder->mCeFunction->mMethodInstance).c_str()),
|
||||||
|
parser, filePos.mCurSrcPos, 1, BfFailFlag_None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bfError = srcModule->Fail(error, refNode);
|
||||||
|
}
|
||||||
|
return bfError;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CeMachine::FailCurrentMoreInfo(const StringImpl& error, BfAstNode* refNode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -839,6 +839,7 @@ public:
|
||||||
CeOperand mReturnVal;
|
CeOperand mReturnVal;
|
||||||
BeType* mIntPtrType;
|
BeType* mIntPtrType;
|
||||||
int mPtrSize;
|
int mPtrSize;
|
||||||
|
int mRecursiveDepth;
|
||||||
|
|
||||||
String mError;
|
String mError;
|
||||||
BeDbgLoc* mCurDbgLoc;
|
BeDbgLoc* mCurDbgLoc;
|
||||||
|
@ -862,6 +863,7 @@ public:
|
||||||
{
|
{
|
||||||
mParentBuilder = NULL;
|
mParentBuilder = NULL;
|
||||||
mPtrSize = 0;
|
mPtrSize = 0;
|
||||||
|
mRecursiveDepth = -1;
|
||||||
mCeFunction = NULL;
|
mCeFunction = NULL;
|
||||||
mBeFunction = NULL;
|
mBeFunction = NULL;
|
||||||
mCeMachine = NULL;
|
mCeMachine = NULL;
|
||||||
|
@ -1126,6 +1128,7 @@ public:
|
||||||
int mReflectTypeIdOffset;
|
int mReflectTypeIdOffset;
|
||||||
int mExecuteId;
|
int mExecuteId;
|
||||||
CeEvalFlags mCurEvalFlags;
|
CeEvalFlags mCurEvalFlags;
|
||||||
|
int mRecursiveDepth;
|
||||||
|
|
||||||
// These are only valid for the current execution
|
// These are only valid for the current execution
|
||||||
ContiguousHeap* mHeap;
|
ContiguousHeap* mHeap;
|
||||||
|
@ -1248,6 +1251,7 @@ public:
|
||||||
int mRevisionExecuteTime;
|
int mRevisionExecuteTime;
|
||||||
int mCurFunctionId;
|
int mCurFunctionId;
|
||||||
int mExecuteId;
|
int mExecuteId;
|
||||||
|
int mCurRecursiveDepth;
|
||||||
CeAppendAllocInfo* mAppendAllocInfo;
|
CeAppendAllocInfo* mAppendAllocInfo;
|
||||||
|
|
||||||
CeContext* mCurContext;
|
CeContext* mCurContext;
|
||||||
|
@ -1308,6 +1312,9 @@ public:
|
||||||
CeContext* AllocContext();
|
CeContext* AllocContext();
|
||||||
void ReleaseContext(CeContext* context);
|
void ReleaseContext(CeContext* context);
|
||||||
BfTypedValue Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType);
|
BfTypedValue Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType);
|
||||||
|
|
||||||
|
BfError* FailCurrent(BfModule* srcModule, const StringImpl& error, BfAstNode* refNode);
|
||||||
|
void FailCurrentMoreInfo(const StringImpl& error, BfAstNode* refNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BF_END
|
NS_BF_END
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue