| 3536 | } |
| 3537 | |
| 3538 | void BfModule::DoPopulateType_InitSearches(BfTypeInstance* typeInstance) |
| 3539 | { |
| 3540 | if (typeInstance->IsBoxed()) |
| 3541 | return; |
| 3542 | |
| 3543 | auto typeDef = typeInstance->mTypeDef; |
| 3544 | |
| 3545 | auto _AddStaticSearch = [&](BfTypeDef* typeDef) |
| 3546 | { |
| 3547 | if (!typeDef->mStaticSearch.IsEmpty()) |
| 3548 | { |
| 3549 | BfStaticSearch* staticSearch; |
| 3550 | if (typeInstance->mStaticSearchMap.TryAdd(typeDef, NULL, &staticSearch)) |
| 3551 | { |
| 3552 | SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, typeDef); |
| 3553 | for (auto typeRef : typeDef->mStaticSearch) |
| 3554 | { |
| 3555 | auto staticType = ResolveTypeRef(typeRef, NULL, BfPopulateType_Identity); |
| 3556 | if (staticType != NULL) |
| 3557 | { |
| 3558 | auto staticTypeInst = staticType->ToTypeInstance(); |
| 3559 | if (staticTypeInst == NULL) |
| 3560 | { |
| 3561 | Fail(StrFormat("Type '%s' cannot be used in a 'using static' declaration", TypeToString(staticType).c_str()), typeRef); |
| 3562 | } |
| 3563 | else |
| 3564 | { |
| 3565 | staticSearch->mStaticTypes.Add(staticTypeInst); |
| 3566 | AddDependency(staticTypeInst, typeInstance, BfDependencyMap::DependencyFlag_StaticValue); |
| 3567 | } |
| 3568 | } |
| 3569 | } |
| 3570 | } |
| 3571 | } |
| 3572 | if (!typeDef->mInternalAccessSet.IsEmpty()) |
| 3573 | { |
| 3574 | BfInternalAccessSet* internalAccessSet; |
| 3575 | BF_ASSERT(!typeDef->IsEmitted()); |
| 3576 | if (typeInstance->mInternalAccessMap.TryAdd(typeDef, NULL, &internalAccessSet)) |
| 3577 | { |
| 3578 | for (auto typeRef : typeDef->mInternalAccessSet) |
| 3579 | { |
| 3580 | if ((typeRef->IsA<BfNamedTypeReference>()) || |
| 3581 | (typeRef->IsA<BfQualifiedTypeReference>())) |
| 3582 | { |
| 3583 | String checkNamespaceStr; |
| 3584 | typeRef->ToString(checkNamespaceStr); |
| 3585 | BfAtomCompositeT<16> checkNamespace; |
| 3586 | if (mSystem->ParseAtomComposite(checkNamespaceStr, checkNamespace)) |
| 3587 | { |
| 3588 | if (mSystem->ContainsNamespace(checkNamespace, typeDef->mProject)) |
| 3589 | { |
| 3590 | mSystem->RefAtomComposite(checkNamespace); |
| 3591 | internalAccessSet->mNamespaces.Add(checkNamespace); |
| 3592 | continue; |
| 3593 | } |
| 3594 | } |
| 3595 | } |
nothing calls this directly
no test coverage detected