MCPcopy Create free account
hub / github.com/beefytech/Beef / PopulateGlobalContainersList

Method PopulateGlobalContainersList

IDEHelper/Compiler/BfModule.cpp:3994–4068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3992}
3993
3994void BfModule::PopulateGlobalContainersList(const BfGlobalLookup& globalLookup)
3995{
3996 if (mContext->mCurTypeState == NULL)
3997 return;
3998
3999 BP_ZONE("PopulateGlobalContainersList");
4000
4001 BfTypeDef* userTypeDef = GetActiveTypeDef();
4002
4003 if (mContext->mCurTypeState->mGlobalContainerCurUserTypeDef != userTypeDef)
4004 {
4005 mContext->mCurTypeState->mGlobalContainers.Clear();
4006 for (int namespaceIdx = -1; namespaceIdx < (int)userTypeDef->mNamespaceSearch.size(); namespaceIdx++)
4007 {
4008 BfAtomComposite findStr;
4009 if (namespaceIdx != -1)
4010 findStr.Reference(userTypeDef->mNamespaceSearch[namespaceIdx]);
4011 auto typeDefItr = mSystem->mTypeDefs.TryGet(findStr);
4012 while (typeDefItr)
4013 {
4014 auto typeDef = *typeDefItr;
4015 if ((typeDef->mFullName == findStr) && (typeDef->mIsCombinedPartial) && (typeDef->IsGlobalsContainer()))
4016 {
4017 if (typeDef->mProject->ContainsReference(typeDef->mProject))
4018 {
4019 BfGlobalContainerEntry globalEntry;
4020 globalEntry.mTypeDef = typeDef;
4021 globalEntry.mTypeInst = NULL;
4022 typeDef->PopulateMemberSets();
4023 mContext->mCurTypeState->mGlobalContainers.Add(globalEntry);
4024 }
4025 }
4026 else if (!typeDef->mIsPartial)
4027 {
4028 //break;
4029 }
4030
4031 typeDefItr.MoveToNextHashMatch();
4032 }
4033 }
4034
4035 mContext->mCurTypeState->mGlobalContainerCurUserTypeDef = userTypeDef;
4036 }
4037
4038 // Only create actual typeInst when we have an applicable member. This helps in keeping unused globals from
4039 // reifing types
4040 for (auto& globalEntry : mContext->mCurTypeState->mGlobalContainers)
4041 {
4042 if (globalEntry.mTypeInst == NULL)
4043 {
4044 bool include = false;
4045 if (globalLookup.mKind == BfGlobalLookup::Kind_All)
4046 include = true;
4047 else if (globalLookup.mKind == BfGlobalLookup::Kind_Field)
4048 {
4049 if (globalEntry.mTypeDef->mFieldSet.ContainsWith(globalLookup.mName))
4050 include = true;
4051 if (globalEntry.mTypeDef->mPropertySet.ContainsWith(globalLookup.mName))

Callers 5

CheckIdentifierMethod · 0.80
CheckMemberReferenceMethod · 0.80
LookupIdentifierMethod · 0.80
MatchMethodMethod · 0.80
InjectMixinMethod · 0.80

Calls 11

ContainsReferenceMethod · 0.80
PopulateMemberSetsMethod · 0.80
ContainsWithMethod · 0.80
ClearMethod · 0.45
sizeMethod · 0.45
ReferenceMethod · 0.45
TryGetMethod · 0.45
IsGlobalsContainerMethod · 0.45
AddMethod · 0.45
MoveToNextHashMatchMethod · 0.45
ToTypeInstanceMethod · 0.45

Tested by

no test coverage detected