Ejemplo n.º 1
0
void AllContainersInFileInOrderIterator::Init
(
    SourceFile *pFile,
    bool fIncludePartialContainers,
    bool fIncludeTransientTypes
)
{

    // Free the memory.
    m_nra.FreeHeap();

    if (pFile != NULL)
    {
        SymbolList *pList = pFile->GetNamespaceLevelSymbolList();
        unsigned cContainers = pList->GetCount();
        BCSYM_Container **ppContainer;
        BCSYM_NamedRoot *pCurrent, *pContainer;

        IfFalseThrow(cContainers + 1 > cContainers);
        ppContainer = m_ppNext = (BCSYM_Container **)m_nra.Alloc(VBMath::Multiply(
            (cContainers + 1), 
            sizeof(BCSYM_Container *)));

        for (pCurrent = pList->GetFirst(); pCurrent; pCurrent = pCurrent->GetNextInSymbolList())
        {

            pContainer = pCurrent->DigThroughAlias()->PNamedRoot();

            if (pContainer->IsContainer() &&
                (fIncludePartialContainers || !pContainer->PContainer()->IsPartialTypeAndHasMainType()) &&
                (fIncludeTransientTypes || !pContainer->IsTransientClass())
               )
            {
                *ppContainer = pContainer->PContainer();
                ppContainer++;
            }
        }

        // Sort the list in file definition order.
        extern int _cdecl SortSymbolsByLocation(const void *arg1, const void *arg2);

        qsort(m_ppNext, ppContainer - m_ppNext, sizeof(BCSYM_Container *), SortSymbolsByLocation);
    }
    else
    {
        m_ppNext =  NULL;
    }
}
Ejemplo n.º 2
0
void AllContainersInFileIterator::Init
(
    CompilerFile *pFile,
    bool fIncludePartialContainers,
    bool fIncludeTransientSymbols
)
{
    if (pFile != NULL)
    {
        SymbolList *pList = pFile->GetNamespaceLevelSymbolList();

        m_pNext = pList->GetFirst();
    }
    else
    {
        m_pNext =  NULL;
    }

    m_fIncludePartialContainers = fIncludePartialContainers;
    m_fIncludeTransientSymbols = fIncludeTransientSymbols;
}