Package org.apache.flex.compiler.scopes

Examples of org.apache.flex.compiler.scopes.IDefinitionSet


    }

    @Override
    public IDefinitionSet getLocalDefinitionSetByName(String name)
    {
        IDefinitionSet definitionSet = null;
        boolean containsPromise = false;

        readLock.lock();
        try
        {
            // Get the definition set from the store.
            definitionSet = super.getLocalDefinitionSetByName(name);

            // Does it contain any promises?
            if (definitionSet != null)
            {
                int n = definitionSet.getSize();
                for (int i = 0; i < n; i++)
                {
                    IDefinition definition = definitionSet.getDefinition(i);
                    if (definition instanceof DefinitionPromise)
                    {
                        containsPromise = true;
                        break;
                    }
                }
            }
        }
        finally
        {
            readLock.unlock();
        }

        IDefinitionSet returnedDefinitionSet = definitionSet;

        if (containsPromise)
        {
            // Note that we lock for writing only if there is a promise to replace.
            writeLock.lock();
View Full Code Here


            for (IResolvedQualifiersReference reference : references)
            {
                String baseName = reference.getName();
                // use super.getDefinitionSetByName so we don't turn definition promises into
                // actual definitions.  Doing so would require parsing files which would be slow.
                IDefinitionSet definitionSet = super.getLocalDefinitionSetByName(baseName);
                ICompilationUnit cu = null;
                if (definitionSet != null)
                {
                    int n = definitionSet.getSize();
                    for (int i = 0; i < n; i++)
                    {
                        IDefinition definition = definitionSet.getDefinition(i);
                        String definitionQualifiedName = definition.getQualifiedName();
                        if (referenceMatchesQName(workspace, reference, definitionQualifiedName))
                        {
                            cu = getCompilationUnitForDefinition(definition);
                            assert cu != null : "All symbol table entries should have a corresponding CU!";
View Full Code Here

    {
        Set<ICompilationUnit> compilationUnits = new HashSet<ICompilationUnit>();
        readLock.lock();
        try
        {
            IDefinitionSet definitionSet = super.getLocalDefinitionSetByName(name);
            if (definitionSet != null)
            {
                int n = definitionSet.getSize();
                for (int i = 0; i < n; i++)
                {
                    IDefinition definition = definitionSet.getDefinition(i);
                    ICompilationUnit compilationUnit;
                    if (definition instanceof DefinitionPromise)
                    {
                        compilationUnit = ((DefinitionPromise)definition).getCompilationUnit();
                    }
View Full Code Here

        for (String name : names)
        {
            // Note: The override of getLocalDefinitionSetByName() in this class
            // will convert definition promises to actual definitions.
            IDefinitionSet set = getLocalDefinitionSetByName(name);
            result.add(set);
        }

        return result;
    }
View Full Code Here

        for (String name : names)
        {
            // Note: The override of getLocalDefinitionSetByName() in this class
            // will convert definition promises to actual definitions.
            IDefinitionSet set = getLocalDefinitionSetByName(name);
            int n = set.getSize();
            for (int i = 0; i < n; i++)
            {
                IDefinition definition = set.getDefinition(i);
                result.add(definition);
            }
        }

        return result;
View Full Code Here

            String newDefinitionQName = definition.getQualifiedName();
            String newDefBaseName = definition.getBaseName();
            // It's important that we use super.getLocalDefinitionSetByName() here;
            // we don't want to cause getActualDefinition() to be called on
            // any definition promises.
            IDefinitionSet defSet = super.getLocalDefinitionSetByName(newDefBaseName);
            if (defSet != null)
            {
                int nDefs = defSet.getSize();
                for (int i = 0; i < nDefs; ++i)
                {
                    IDefinition existingDef = defSet.getDefinition(i);
                    String existingDefQName = existingDef.getQualifiedName();
                    if (existingDefQName.equals(newDefinitionQName))
                        return (DefinitionBase)existingDef;
                }
            }
View Full Code Here

    // Remove this override when we start using Set<IDefinition>.
    // We could have made accumulateDefinitions() virtual instead of getLocalProperty(),
    // but that would have had worse performance.
    private void getLocalProperty(ICompilationUnit referencingCU, ICompilerProject project, Collection<IDefinition> defs, String baseName, Set<INamespaceDefinition> namespaceSet, boolean getContingents, INamespaceDefinition extraNamespace)
    {
        IDefinitionSet defSet = getLocalDefinitionSetByName(baseName);
        if (defSet != null)
        {
            int nDefs = defSet.getSize();
            for (int i = 0; i < nDefs; ++i)
            {
                IDefinition definition = defSet.getDefinition(i);
                accumulateMatchingDefinitions(referencingCU, project, defs, namespaceSet, getContingents, extraNamespace, definition);
            }
        }
    }
View Full Code Here

        assert definition != null: "Definition cannot be null";
        assert getBaseName(oldDefinitionSet) == null || getBaseName(oldDefinitionSet).equals(definition.getBaseName()) : "Base name must match";
       
        // We will probably have to create a new set,
        // but we might be able to re-use the old one.
        IDefinitionSet newDefinitionSet = oldDefinitionSet;

        if (oldDefinitionSet == null)
        {
            // There was no old set. Use the new definition itself as a new set-of-size-1.
            // This is possible because DefinitionBase implements IDefinitionSet.
View Full Code Here

        // return false to indicate that this store is full.
        if (i == -1)
            return false;

        // Get the definition set from the field we've found. It might be null.
        IDefinitionSet oldDefinitionSet = getDefinitionSet(i);
       
        // Add the new definition to the old set. This may create a new set.
        IDefinitionSet newDefinitionSet = addDefinitionToSet(oldDefinitionSet, definition);
       
        // Store the new set into the field.
        if (newDefinitionSet != oldDefinitionSet)
            setDefinitionSet(i, newDefinitionSet);
View Full Code Here

        // doesn't exist in this store.
        if (i == -1)
            return false;
       
        // Get the definition set from the field we've found. It will not be null.
        IDefinitionSet oldDefinitionSet = getDefinitionSet(i);
       
        // Remove the definition from the set,
        // and perhaps remove the set from this store.
        if (removeDefinitionFromSet(oldDefinitionSet, definition))
            setDefinitionSet(i, null);
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.scopes.IDefinitionSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.