mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Improvements to warn/error type attributes
This commit is contained in:
parent
b3d3f0fb54
commit
efbdc33622
3 changed files with 52 additions and 6 deletions
|
@ -429,6 +429,31 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
|||
didWork = true;
|
||||
}
|
||||
|
||||
for (int workIdx = 0; workIdx < (int)mTypeRefVerifyWorkList.size(); workIdx++)
|
||||
{
|
||||
if (IsCancellingAndYield())
|
||||
break;
|
||||
|
||||
auto workItemRef = mTypeRefVerifyWorkList[workIdx];
|
||||
if (workItemRef == NULL)
|
||||
{
|
||||
workIdx = mTypeRefVerifyWorkList.RemoveAt(workIdx);
|
||||
continue;
|
||||
}
|
||||
|
||||
SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(workItemRef->mFromModule->mCurTypeInstance, workItemRef->mCurTypeInstance);
|
||||
|
||||
auto refTypeInst = workItemRef->mType->ToTypeInstance();
|
||||
if (refTypeInst->mCustomAttributes == NULL)
|
||||
workItemRef->mFromModule->PopulateType(refTypeInst, BfPopulateType_AllowStaticMethods);
|
||||
|
||||
if (refTypeInst != NULL)
|
||||
workItemRef->mFromModule->CheckErrorAttributes(refTypeInst, NULL, refTypeInst->mCustomAttributes, workItemRef->mRefNode);
|
||||
|
||||
workIdx = mTypeRefVerifyWorkList.RemoveAt(workIdx);
|
||||
didWork = true;
|
||||
}
|
||||
|
||||
//while (mMethodSpecializationWorkList.size() != 0)
|
||||
|
||||
// For the first pass, we want to handle the reified requests first. This helps rebuilds require
|
||||
|
@ -2743,7 +2768,7 @@ void DoRemoveInvalidWorkItems(BfContext* bfContext, WorkQueue<T>& workList, bool
|
|||
if (workItem == NULL)
|
||||
continue;
|
||||
|
||||
auto typeInst = workItem->mType->ToTypeInstance();
|
||||
BfTypeInstance* typeInst = workItem->mType->ToTypeInstance();
|
||||
|
||||
if ((workItem->mType->IsDeleting()) ||
|
||||
(workItem->mType->mRebuildFlags & BfTypeRebuildFlag_Deleted) ||
|
||||
|
@ -2805,6 +2830,7 @@ void BfContext::RemoveInvalidWorkItems()
|
|||
DoRemoveInvalidWorkItems<BfTypeProcessRequest>(this, mPopulateTypeWorkList, false);
|
||||
DoRemoveInvalidWorkItems<BfMethodSpecializationRequest>(this, mMethodSpecializationWorkList, false/*true*/);
|
||||
|
||||
DoRemoveInvalidWorkItems<BfTypeRefVerifyRequest>(this, mTypeRefVerifyWorkList, false);
|
||||
|
||||
#ifdef _DEBUG
|
||||
for (auto& workItem : mMethodWorkList)
|
||||
|
|
|
@ -106,6 +106,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class BfTypeRefVerifyRequest : public BfWorkListEntry
|
||||
{
|
||||
public:
|
||||
BfTypeInstance* mCurTypeInstance;
|
||||
BfAstNode* mRefNode;
|
||||
};
|
||||
|
||||
struct BfStringPoolEntry
|
||||
{
|
||||
String mString;
|
||||
|
@ -384,6 +391,7 @@ public:
|
|||
WorkQueue<BfInlineMethodRequest> mInlineMethodWorkList;
|
||||
WorkQueue<BfTypeProcessRequest> mPopulateTypeWorkList;
|
||||
WorkQueue<BfMethodSpecializationRequest> mMethodSpecializationWorkList;
|
||||
WorkQueue<BfTypeRefVerifyRequest> mTypeRefVerifyWorkList;
|
||||
PtrWorkQueue<BfModule*> mFinishedSlotAwaitModuleWorkList;
|
||||
PtrWorkQueue<BfModule*> mFinishedModuleWorkList;
|
||||
|
||||
|
|
|
@ -8669,8 +8669,20 @@ BfType* BfModule::ResolveTypeResult(BfTypeReference* typeRef, BfType* resolvedTy
|
|||
|
||||
if (typeInstance != NULL)
|
||||
{
|
||||
if ((typeInstance->mCustomAttributes != NULL) && (!typeRef->IsTemporary()))
|
||||
CheckErrorAttributes(typeInstance, NULL, typeInstance->mCustomAttributes, typeRef);
|
||||
if ((!typeRef->IsTemporary()) && ((resolveFlags & BfResolveTypeRefFlag_FromIndirectSource) == 0))
|
||||
{
|
||||
if (typeInstance->mCustomAttributes != NULL)
|
||||
CheckErrorAttributes(typeInstance, NULL, typeInstance->mCustomAttributes, typeRef);
|
||||
else if ((typeInstance->mTypeDef->mTypeDeclaration != NULL) && (typeInstance->mTypeDef->mTypeDeclaration->mAttributes != NULL))
|
||||
{
|
||||
auto typeRefVerifyRequest = mContext->mTypeRefVerifyWorkList.Alloc();
|
||||
typeRefVerifyRequest->mCurTypeInstance = mCurTypeInstance;
|
||||
typeRefVerifyRequest->mRefNode = typeRef;
|
||||
typeRefVerifyRequest->mType = typeInstance;
|
||||
typeRefVerifyRequest->mFromModule = this;
|
||||
typeRefVerifyRequest->mFromModuleRevision = mRevision;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeInstance->IsTuple())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue