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

Method MarkUsedModules

IDEHelper/Compiler/BfContext.cpp:3427–3478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3425}
3426
3427void BfContext::MarkUsedModules(BfProject* project, BfModule* module)
3428{
3429 BP_ZONE("BfContext::MarkUsedModules");
3430
3431 if (module->mIsDeleting)
3432 return;
3433
3434 BF_ASSERT_REL(!module->mIsDeleting);
3435
3436 if (module->mIsScratchModule)
3437 return;
3438
3439 if (project->mUsedModules.Contains(module))
3440 return;
3441
3442 if (!mCompiler->IsModuleAccessible(module, project))
3443 return;
3444
3445 project->mUsedModules.Add(module);
3446
3447 for (auto& typeDataKV : module->mTypeDataRefs)
3448 project->mReferencedTypeData.Add(typeDataKV.mKey);
3449
3450 for (auto& slotKV : module->mInterfaceSlotRefs)
3451 {
3452 auto typeInstance = slotKV.mKey;
3453 if ((typeInstance->mSlotNum < 0) && (mCompiler->mHotState != NULL))
3454 mCompiler->mHotState->mHasNewInterfaceTypes = true;
3455 mReferencedIFaceSlots.Add(typeInstance);
3456 }
3457
3458 for (auto& kv : module->mStaticFieldRefs)
3459 {
3460 auto& fieldRef = kv.mKey;
3461 auto typeInst = fieldRef.mTypeInstance;
3462 BF_ASSERT(!typeInst->IsDataIncomplete());
3463 BF_ASSERT(fieldRef.mFieldIdx < typeInst->mFieldInstances.size());
3464 if (fieldRef.mFieldIdx < typeInst->mFieldInstances.size())
3465 typeInst->mFieldInstances[fieldRef.mFieldIdx].mLastRevisionReferenced = mCompiler->mRevision;
3466 }
3467
3468 module->mLastUsedRevision = mCompiler->mRevision;
3469 for (auto usedModule : module->mModuleRefs)
3470 {
3471 MarkUsedModules(project, usedModule);
3472 }
3473
3474 for (auto& kv : module->mSpecializedMethodModules)
3475 {
3476 MarkUsedModules(project, kv.mValue);
3477 }
3478}
3479
3480void BfContext::Finish()
3481{

Callers 1

DoCompileMethod · 0.80

Calls 5

IsModuleAccessibleMethod · 0.80
ContainsMethod · 0.45
AddMethod · 0.45
IsDataIncompleteMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected