bool CLSComplianceChecker::IsAccessibleOutsideAssembly(BCSYM_NamedRoot * Member) { // Namespaces are always public // if (Member->IsNamespace()) { return true; } ACCESS AccessOfMember = Member->GetAccess(); if (AccessOfMember == ACCESS_Private || AccessOfMember == ACCESS_Friend) { return false; } if (AccessOfMember == ACCESS_Protected || AccessOfMember == ACCESS_ProtectedFriend) { BCSYM_Container *ContainerOfMember = Member->GetContainer(); VSASSERT( ContainerOfMember, "How can a non-namespace entity not be enclosed in another container ?"); // If the containing class is notinheritable, then the protected members are // not accessible outside the assembly since nobody can inherit the class. // // Confirmed this with [....] and jsmiller // if (ContainerOfMember->IsClass() && ContainerOfMember->PClass()->IsNotInheritable()) { return false; } return true; } VSASSERT( AccessOfMember == ACCESS_Public, "What else can the access be ?"); return true; }
void Bindable::ValidateWithEventsVarsAndHookUpHandlersInContainer() { VSASSERT( GetStatusOfValidateWithEventsVarsAndHookUpHandlers() != InProgress, "How can we have have event validation cycles ?"); if (GetStatusOfValidateWithEventsVarsAndHookUpHandlers() == Done) { return; } BCSYM_Container *Container = CurrentContainer(); if (!Container->IsClass() || TypeHelpers::IsEnumType(Container->PClass())) { SetStatusOfValidateWithEventsVarsAndHookUpHandlers(Done); return; } SetStatusOfValidateWithEventsVarsAndHookUpHandlers(InProgress); // Makes sure validation of withevents and shadowing, etc. of the types // of the withevents variables in bases are done. // BCSYM_Class *Base = Container->PClass()->GetCompilerBaseClass(); if (Base) { ValidateWithEventsVarsAndHookUpHandlersInContainer(Base, m_CompilationCaches); } // Need to use the SAFE iterator because more members might // be added to the Container during hookuping of Handles. // This adding of member will happen while the iterator is // still in use. // BCITER_CHILD_SAFE Members(Container); // Validate all the withevent vars in this container while (BCSYM_NamedRoot *Member = Members.GetNext()) { if (IsWithEventsVariable(Member)) { ValidateWithEventsVar(Member->PVariable()); } } // Validate and hookup all the handles clauses specified in this container Members.Reset(); while (BCSYM_NamedRoot *Member = Members.GetNext()) { // Only methods with implementation can have handles clauses // if (!Member->IsMethodImpl()) { continue; } BCITER_Handles iterHandles( Member->PMethodImpl() ); for(BCSYM_HandlesList *HandlesEntry = iterHandles.GetNext(); HandlesEntry; HandlesEntry = iterHandles.GetNext()) { if (HandlesEntry->IsBad()) { continue; } ValidateAndHookUpHandles( HandlesEntry, Member->PMethodImpl()); } } SetStatusOfValidateWithEventsVarsAndHookUpHandlers(Done); }