| 3425 | } |
| 3426 | |
| 3427 | void 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 | |
| 3480 | void BfContext::Finish() |
| 3481 | { |
no test coverage detected