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

Method PopulateUsingFieldData

IDEHelper/Compiler/BfModuleTypeUtils.cpp:3227–3414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3225}
3226
3227void BfModule::PopulateUsingFieldData(BfTypeInstance* typeInstance)
3228{
3229 if (typeInstance->mTypeInfoEx == NULL)
3230 typeInstance->mTypeInfoEx = new BfTypeInfoEx();
3231
3232 BfUsingFieldData* usingFieldData;
3233 if (typeInstance->mTypeInfoEx->mUsingFieldData != NULL)
3234 {
3235 usingFieldData = typeInstance->mTypeInfoEx->mUsingFieldData;
3236 Array<BfTypeInstance*> populatedTypes;
3237
3238 for (auto checkType : usingFieldData->mAwaitingPopulateSet)
3239 {
3240 if (checkType->mDefineState >= BfTypeDefineState_Defined)
3241 populatedTypes.Add(checkType);
3242 }
3243
3244 if (populatedTypes.IsEmpty())
3245 return;
3246
3247 for (auto type : populatedTypes)
3248 usingFieldData->mAwaitingPopulateSet.Remove(type);
3249 usingFieldData->mEntries.Clear();
3250 usingFieldData->mMethods.Clear();
3251 }
3252 else
3253 {
3254 usingFieldData = new BfUsingFieldData();
3255 typeInstance->mTypeInfoEx->mUsingFieldData = usingFieldData;
3256 }
3257
3258 HashSet<BfTypeInstance*> checkedTypeSet;
3259 Array<BfUsingFieldData::MemberRef> memberRefs;
3260 std::function<void(BfTypeInstance*, bool)> _CheckType = [&](BfTypeInstance* usingType, bool staticOnly)
3261 {
3262 if (!checkedTypeSet.Add(usingType))
3263 return;
3264 defer(
3265 {
3266 checkedTypeSet.Remove(usingType);
3267 });
3268
3269 for (auto fieldDef : usingType->mTypeDef->mFields)
3270 {
3271 if ((staticOnly) && (!fieldDef->mIsStatic))
3272 continue;
3273
3274 memberRefs.Add(BfUsingFieldData::MemberRef(usingType, fieldDef));
3275 defer(
3276 {
3277 memberRefs.pop_back();
3278 });
3279
3280 if (memberRefs.Count() > 1)
3281 {
3282 BfUsingFieldData::Entry* entry = NULL;
3283 usingFieldData->mEntries.TryAdd(fieldDef->mName, NULL, &entry);
3284 SizedArray<BfUsingFieldData::MemberRef, 1> lookup;

Callers 3

AddTypeMembersMethod · 0.80
CheckTypeMethod · 0.80
LookupFieldMethod · 0.80

Calls 12

CountMethod · 0.80
MemberRefClass · 0.70
AddMethod · 0.45
IsEmptyMethod · 0.45
RemoveMethod · 0.45
ClearMethod · 0.45
pop_backMethod · 0.45
TryAddMethod · 0.45
ToTypeInstanceMethod · 0.45
GetParamCountMethod · 0.45
GetParamTypeMethod · 0.45
IsTypeInstanceMethod · 0.45

Tested by

no test coverage detected