mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fix for globals namespace conflicting with extension name
This commit is contained in:
parent
a2047f444d
commit
37fc1a08e1
3 changed files with 26 additions and 14 deletions
|
@ -2841,7 +2841,7 @@ void BfCompiler::UpdateRevisedTypes()
|
|||
if (nextTypeDef->mNextRevision != NULL)
|
||||
nextTypeDef = nextTypeDef->mNextRevision;
|
||||
if ((nextTypeDef->mIsCombinedPartial) || (nextTypeDef->mDefState == BfTypeDef::DefState_Deleted) || (nextTypeDef->mTypeCode == BfTypeCode_Extension) ||
|
||||
(typeDef->mFullName != nextTypeDef->mFullName) || (typeDef->mGenericParamDefs.size() != nextTypeDef->mGenericParamDefs.size()))
|
||||
(typeDef->mFullNameEx != nextTypeDef->mFullNameEx) || (typeDef->mGenericParamDefs.size() != nextTypeDef->mGenericParamDefs.size()))
|
||||
{
|
||||
nextTypeDefItr.MoveToNextHashMatch();
|
||||
continue;
|
||||
|
@ -2981,12 +2981,10 @@ void BfCompiler::UpdateRevisedTypes()
|
|||
auto checkTypeDefEntry = mSystem->mTypeDefs.mHashHeads[bucketIdx];
|
||||
while (checkTypeDefEntry != NULL)
|
||||
{
|
||||
// This clears the mPartialUsed flag for the whole bucket
|
||||
auto checkTypeDef = checkTypeDefEntry->mValue;
|
||||
if ((checkTypeDefEntry->mHash == outerTypeDefEntry->mHash) &&
|
||||
(checkTypeDef->NameEquals(outerTypeDef)))
|
||||
{
|
||||
if ((checkTypeDef->mIsPartial) || (checkTypeDef->mIsCombinedPartial))
|
||||
checkTypeDef->mPartialUsed = false;
|
||||
}
|
||||
checkTypeDefEntry = checkTypeDefEntry->mNext;
|
||||
}
|
||||
hadPartials = true;
|
||||
|
@ -3230,6 +3228,8 @@ void BfCompiler::UpdateRevisedTypes()
|
|||
checkTypeDef->mIsPartial = true;
|
||||
checkTypeDef->mDefState = BfTypeDef::DefState_Defined;
|
||||
mSystem->AddToCompositePartial(mPassInstance, compositeTypeDef, checkTypeDef);
|
||||
|
||||
BfLogSysM("AddToCompositePartial %p added to %p\n", checkTypeDef, compositeTypeDef);
|
||||
}
|
||||
mSystem->FinishCompositePartial(compositeTypeDef);
|
||||
|
||||
|
|
|
@ -1643,10 +1643,17 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
|
|||
mCurTypeDef->mNameEx->mRefCount++;
|
||||
}
|
||||
if (!fullName.IsEmpty())
|
||||
{
|
||||
if (mCurTypeDef->IsGlobalsContainer())
|
||||
{
|
||||
mCurTypeDef->mFullNameEx.Set(fullName.mParts, fullName.mSize, &mCurTypeDef->mNameEx, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurTypeDef->mFullNameEx = fullName;
|
||||
mCurTypeDef->mFullNameEx.mParts[mCurTypeDef->mFullNameEx.mSize - 1] = mCurTypeDef->mNameEx;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto defineBlock = BfNodeDynCast<BfBlock>(typeDeclaration->mDefineNode))
|
||||
{
|
||||
|
|
|
@ -841,6 +841,8 @@ void BfTypeDef::ReportMemory(MemReporter* memReporter)
|
|||
|
||||
bool BfTypeDef::NameEquals(BfTypeDef* otherTypeDef)
|
||||
{
|
||||
if (mName != otherTypeDef->mName)
|
||||
return false;
|
||||
// We can't just check mFullnames, because a namespace of "A" with a type named "B.C" would match
|
||||
// a namespace of "A.B" with a type named "C"
|
||||
if (mNamespace.mSize != otherTypeDef->mNamespace.mSize)
|
||||
|
@ -2596,6 +2598,9 @@ void BfSystem::InjectNewRevision(BfTypeDef* typeDef)
|
|||
BF_ASSERT(typeDef->mNameEx == nextTypeDef->mNameEx);
|
||||
//typeDef->mNameEx = nextTypeDef->mNameEx;
|
||||
//typeDef->mFullName = nextTypeDef->mFullName;
|
||||
|
||||
BF_ASSERT(typeDef->mFullNameEx == nextTypeDef->mFullNameEx);
|
||||
|
||||
typeDef->mProtection = nextTypeDef->mProtection;
|
||||
if ((typeDef->mTypeCode != BfTypeCode_Extension) && (!typeDef->mIsCombinedPartial))
|
||||
BF_ASSERT(nextTypeDef->mTypeCode != BfTypeCode_Extension);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue