mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
TypeDef MemberSet fixes
This commit is contained in:
parent
cfaeb875f8
commit
069e327850
3 changed files with 28 additions and 37 deletions
|
@ -2115,8 +2115,6 @@ void BfModule::UpdateCEEmit(CeEmitContext* ceEmitContext, BfTypeInstance* typeIn
|
|||
defBuilder.DoVisitChild(typeDeclaration->mDefineNode);
|
||||
defBuilder.FinishTypeDef(typeInstance->mTypeDef->mTypeCode == BfTypeCode_Enum);
|
||||
|
||||
typeInstance->mTypeDef->ClearOldMemberSets();
|
||||
|
||||
FinishCEParseContext(refNode, typeInstance, &ceParseContext);
|
||||
|
||||
if (typeInstance->mTypeDef->mEmitParent != NULL)
|
||||
|
|
|
@ -712,11 +712,9 @@ void BfTypeDef::FreeMembers()
|
|||
|
||||
void BfTypeDef::PopulateMemberSets()
|
||||
{
|
||||
if ((!mMethodSet.IsEmpty()) || (!mFieldSet.IsEmpty()) || (!mPropertySet.IsEmpty()))
|
||||
return;
|
||||
|
||||
for (auto methodDef : mMethods)
|
||||
while (mMethodSet.mSourceSize < mMethods.mSize)
|
||||
{
|
||||
auto methodDef = mMethods[mMethodSet.mSourceSize++];
|
||||
BF_ASSERT(methodDef->mNextWithSameName == NULL);
|
||||
|
||||
BfMemberSetEntry* entry;
|
||||
|
@ -724,11 +722,12 @@ void BfTypeDef::PopulateMemberSets()
|
|||
{
|
||||
methodDef->mNextWithSameName = (BfMethodDef*)entry->mMemberDef;
|
||||
entry->mMemberDef = methodDef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto fieldDef : mFields)
|
||||
while (mFieldSet.mSourceSize < mFields.mSize)
|
||||
{
|
||||
auto fieldDef = mFields[mFieldSet.mSourceSize++];
|
||||
BF_ASSERT(fieldDef->mNextWithSameName == NULL);
|
||||
|
||||
BfMemberSetEntry* entry;
|
||||
|
@ -739,8 +738,9 @@ void BfTypeDef::PopulateMemberSets()
|
|||
}
|
||||
}
|
||||
|
||||
for (auto propDef : mProperties)
|
||||
while (mPropertySet.mSourceSize < mProperties.mSize)
|
||||
{
|
||||
auto propDef = mProperties[mPropertySet.mSourceSize++];
|
||||
BF_ASSERT(propDef->mNextWithSameName == NULL);
|
||||
|
||||
BfMemberSetEntry* entry;
|
||||
|
@ -767,30 +767,6 @@ void BfTypeDef::ClearMemberSets()
|
|||
mPropertySet.Clear();
|
||||
}
|
||||
|
||||
void BfTypeDef::ClearOldMemberSets()
|
||||
{
|
||||
if ((mMethodSet.mCount > 0) && (mMethods.mSize > mMethodSet.mCount))
|
||||
{
|
||||
for (auto entry : mMethodSet)
|
||||
((BfMethodDef*)entry.mMemberDef)->mNextWithSameName = NULL;
|
||||
mMethodSet.Clear();
|
||||
}
|
||||
|
||||
if ((mFieldSet.mCount > 0) && (mFields.mSize > mFieldSet.mCount))
|
||||
{
|
||||
for (auto entry : mFieldSet)
|
||||
((BfFieldDef*)entry.mMemberDef)->mNextWithSameName = NULL;
|
||||
mFieldSet.Clear();
|
||||
}
|
||||
|
||||
if ((mPropertySet.mCount > 0) && (mProperties.mSize > mPropertySet.mCount))
|
||||
{
|
||||
for (auto entry : mPropertySet)
|
||||
((BfPropertyDef*)entry.mMemberDef)->mNextWithSameName = NULL;
|
||||
mPropertySet.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
BfTypeDef::~BfTypeDef()
|
||||
{
|
||||
BfLogSysM("BfTypeDef::~BfTypeDef %p\n", this);
|
||||
|
|
|
@ -935,6 +935,24 @@ struct BfMemberSetEntry
|
|||
}
|
||||
};
|
||||
|
||||
class BfTypeDefMemberSet : public HashSet<BfMemberSetEntry>
|
||||
{
|
||||
public:
|
||||
int mSourceSize;
|
||||
|
||||
public:
|
||||
BfTypeDefMemberSet()
|
||||
{
|
||||
mSourceSize = 0;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
HashSet<BfMemberSetEntry>::Clear();
|
||||
mSourceSize = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// For partial classes, the first entry in the map will contain the combined data
|
||||
class BfTypeDef
|
||||
{
|
||||
|
@ -980,9 +998,9 @@ public:
|
|||
Array<BfFieldDef*> mFields;
|
||||
Array<BfPropertyDef*> mProperties;
|
||||
Array<BfMethodDef*> mMethods;
|
||||
HashSet<BfMemberSetEntry> mMethodSet;
|
||||
HashSet<BfMemberSetEntry> mFieldSet;
|
||||
HashSet<BfMemberSetEntry> mPropertySet;
|
||||
BfTypeDefMemberSet mMethodSet;
|
||||
BfTypeDefMemberSet mFieldSet;
|
||||
BfTypeDefMemberSet mPropertySet;
|
||||
Array<BfOperatorDef*> mOperators;
|
||||
Array<BfGenericParamDef*> mGenericParamDefs;
|
||||
Array<BfExternalConstraintDef> mExternalConstraints;
|
||||
|
@ -1072,7 +1090,6 @@ public:
|
|||
void FreeMembers();
|
||||
void PopulateMemberSets();
|
||||
void ClearMemberSets();
|
||||
void ClearOldMemberSets();
|
||||
void RemoveGenericParamDef(BfGenericParamDef* genericParamDef);
|
||||
int GetSelfGenericParamCount();
|
||||
String ToString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue