1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

HiddenAtom fix for non-static nameless types

This commit is contained in:
Brian Fiete 2025-05-21 07:42:49 +02:00
parent ad3c7ce767
commit d67a6243eb
3 changed files with 15 additions and 6 deletions

View file

@ -1555,6 +1555,7 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
mCurTypeDef->mSystem = mSystem;
mCurTypeDef->mProject = mCurSource->mProject;
mCurTypeDef->mIsStatic = typeDeclaration->mStaticSpecifier != NULL;
mCurTypeDef->mNamespace = mNamespace;
mSystem->AddNamespaceUsage(mCurTypeDef->mNamespace, mCurTypeDef->mProject);
if ((typeDeclaration->mTypeNode == NULL) && (!isAnonymous))
@ -1570,9 +1571,14 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
}
if (mCurTypeDef->mName == NULL)
{
if (mCurTypeDef->mIsStatic)
{
// Global
mCurTypeDef->mName = mSystem->mGlobalsAtom;
}
else
mCurTypeDef->mName = mSystem->mHiddenAtom;
mCurTypeDef->mName->Ref();
BF_ASSERT(mCurTypeDef->mSystem != NULL);
}
@ -1792,7 +1798,6 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
mCurTypeDef->mSource->mRefCount++;
mCurTypeDef->mTypeDeclaration = typeDeclaration;
mCurTypeDef->mIsAbstract = (typeDeclaration->mAbstractSpecifier != NULL) && (typeDeclaration->mAbstractSpecifier->GetToken() == BfToken_Abstract);
mCurTypeDef->mIsStatic = typeDeclaration->mStaticSpecifier != NULL;
mCurTypeDef->mIsDelegate = false;
mCurTypeDef->mIsFunction = false;

View file

@ -2093,6 +2093,7 @@ BfSystem::BfSystem()
mEmptyAtom = GetAtom("");
mBfAtom = GetAtom("bf");
mGlobalsAtom = GetAtom("@");
mHiddenAtom = GetAtom("?");
mTypeDot = NULL;
if (gBfParserCache == NULL)
@ -2159,6 +2160,7 @@ BfSystem::~BfSystem()
delete project;
ReleaseAtom(mGlobalsAtom);
ReleaseAtom(mHiddenAtom);
ReleaseAtom(mBfAtom);
ReleaseAtom(mEmptyAtom);
ProcessAtomGraveyard();
@ -2729,7 +2731,8 @@ BfTypeDef* BfSystem::FindTypeDef(const BfAtomComposite& findName, int numGeneric
partialStartEntryIdx = -1;
}
if ((typeDef->mFullName == qualifiedFindName) && (CheckTypeDefReference(typeDef, project)))
if ((typeDef->mFullName == qualifiedFindName) && (CheckTypeDefReference(typeDef, project)) /*&&
((allowGlobal) || (!typeDef->IsGlobalsContainer()))*/)
{
int curPri = curNamespacePri;
if (typeDef->mGenericParamDefs.size() != numGenericArgs)

View file

@ -1818,6 +1818,7 @@ public:
Array<BfCompiler*> mCompilers;
BfAtom* mGlobalsAtom;
BfAtom* mHiddenAtom;
BfAtom* mEmptyAtom;
BfAtom* mBfAtom;
CritSect mSystemLock; // long-lived, hold while compiling