void CLSComplianceChecker::VerifyCLSComplianceForContainerAndNestedTypes(BCSYM_Container * Container)
{
    // Partial types are processed when their main type is processed
    //
    if (Container->IsPartialTypeAndHasMainType())
    {
        return;
    }

    ACCESS Access = Container->GetAccess();

    // If the type is not accessible outside the assembly, then
    // don't bother checking for CLS compliance
    //
    if (!IsAccessibleOutsideAssembly(Container))
    {
        return;
    }

    // If the type is a synthetic type, then don't do any checking
    // eg: implicit delegate generated for event
    //
    if (IsSyntheticMember(Container))
    {
        return;
    }

    VerifyCLSComplianceForContainer(Container);

    BCSYM_Container *CurrentContainer = Container;
    do
    {
        for(BCSYM_Container *NestedContainer = CurrentContainer->GetNestedTypes();
            NestedContainer;
            NestedContainer = NestedContainer->GetNextNestedType())
        {
            VerifyCLSComplianceForContainerAndNestedTypes(NestedContainer);
        }

    } while(CurrentContainer = CurrentContainer->GetNextPartialType());
}
Exemple #2
0
void AllEmitableTypesInFileInOrderIterator::GetEmitableTypesInContainer
(
    BCSYM_Container *pContainer,
    _Inout_ int &NestingLevel
)
{
    if (pContainer->IsPartialTypeAndHasMainType())
    {
        return;
    }

    if (!pContainer->IsNamespace())
    {
        EmitableTypeWrapper Wrapper = { pContainer, NestingLevel };

        m_pListOfEmitableTypes.AddElement(Wrapper);
    }

    NestingLevel++;

    BCSYM_Container *pCurrentPartialContainer = pContainer;
    do
    {
        for(BCSYM_Container *pNestedContainer = pCurrentPartialContainer->GetNestedTypes();
            pNestedContainer;
            pNestedContainer = pNestedContainer->GetNextNestedType())
        {
            GetEmitableTypesInContainer(
                pNestedContainer,
                NestingLevel);
        }
    }
    while (pCurrentPartialContainer = pCurrentPartialContainer->GetNextPartialType());

    NestingLevel--;

    return;
}