Package org.apache.flex.compiler.units

Examples of org.apache.flex.compiler.units.ICompilationUnit


        IDefinition definition = projectScope.findDefinitionByName(qname);

        if (definition == null)
            return;

        ICompilationUnit thisCU = getCompilationUnit();
        ICompilationUnit otherCU = projectScope.getCompilationUnitForDefinition(definition);

        // otherCU will be null if qname is "*" because the "*" type does not come from any compilation unit
        if (otherCU != null)
        {
            FlexProject project = getProject();
View Full Code Here


        private EmbedCompilationUnit getEmbeddedCompilationUnit(String attributeName) throws InterruptedException
        {
            if (attributeName == null)
                throw new NullPointerException();
           
            ICompilationUnit splashUnit = null;
            IASNode asNode = getRootNode();
           
            if (!(asNode instanceof IMXMLFileNode))
                return null;
           
View Full Code Here

            // If it is an external dependency then filter based of the dependency types
            // we care about.
            for (Edge dependency : dependencies)
            {
                // Test if the edge is between different swcs
                ICompilationUnit from = dependency.getFrom();
                ICompilationUnit to = dependency.getTo();

                /* Check if the compilation units live in different
                 * swcs. If so, add a dependency between the swcs.
                 */
                if (isInterSWCDependency(from, to))
                {
                    if (dependencySet == null ||
                        dependency.typeInSet(dependencySet) ||
                        dependencySet.isEmpty())
                    {
                        libraryGraph.addLibrary(from.getAbsoluteFilename());
                        libraryGraph.addLibrary(to.getAbsoluteFilename());
                        libraryGraph.addDependency(from.getAbsoluteFilename(), to.getAbsoluteFilename(),
                                dependency.getNamedDependencies());
                    }
                }
            }
        }
View Full Code Here

           
            ClassDefinition mainClassDef = (ClassDefinition) mainApplicationClassDefinition;
            if (mainClassDef.hasOwnFactoryClass(flexProject.getWorkspace()))
                return null;

            ICompilationUnit mainUnit = projectScope.getCompilationUnitForDefinition(mainClassDef);
            IRequest<ISyntaxTreeRequestResult, ICompilationUnit> request = mainUnit.getSyntaxTreeRequest();
            ISyntaxTreeRequestResult result = request.get();

            rootNode = result.getAST();
            return rootNode;
        }
View Full Code Here

        Set<IDefinition> toDefs = scope.getShadowedDefinitions(definitionPromises.get(0));
        if (toDefs != null)
        {
            for (IDefinition def : toDefs)
            {
                ICompilationUnit shadowedUnit = scope.getCompilationUnitForDefinition(def);
               
                // Test if a shadowed unit is in the same swc.
                if (swcPath.equals(shadowedUnit.getAbsoluteFilename()))
                {
                    return true;
                }
            }
        }
View Full Code Here

        int numCompUnitRemoved = 0;
       
        workSet.addAll(compilationUnits);
        while (workSet.size() > 0)
        {
            final ICompilationUnit currentUnit = workSet.iterator().next();
            workSet.remove(currentUnit);

            if (visitedSet.add(currentUnit))
            {
                //Increment num of the comp units removed from the workset,
                //so that we can calculate the total number of compilation units.
                //The reason we only increment it in this if block is that if
                //we don't hit in this if block, it means that we had removed
                //the same compilation unit before anyways, so we already
                //have taken it into account.
                numCompUnitRemoved++;
               
                currentUnit.startBuildAsync(getTargetType());
                
                final DirectDependencies currentUnitDependencies = getDirectDependencies(currentUnit);
                final Iterable<ICompilationUnit> newCompilationUnitWork = currentUnitDependencies.dependencies;
                Iterables.addAll(problems, currentUnitDependencies.problems);
                   
View Full Code Here

        allRelatedCompilationUnits.addAll(includingCompilationUnits);

        HashSet<ICompilationUnit> associatedCompilationUnits = new HashSet<ICompilationUnit>();
        for (WeakReference<ICompilationUnit> relatedCURef : allRelatedCompilationUnits)
        {
          ICompilationUnit relatedCU = relatedCURef.get();
          if (relatedCU != null)
          {
              associatedCompilationUnits.add(relatedCU);
          }
        }
View Full Code Here

    {
        Collection<WeakReference<ICompilationUnit>> compilationUnitRefs = compilationUnitMap.get(sortKey, project);
        ArrayList<ICompilationUnit> compilationUnits = new ArrayList<ICompilationUnit>(compilationUnitRefs.size());
        for (WeakReference<ICompilationUnit> cuRef : compilationUnitRefs)
        {
            final ICompilationUnit cu = cuRef.get();
            // The get method pathToCompilationUnitMapping will filter out compilation units
            // that have been removed from the project, so at this point
            // we can assert the weak references will always return non-null.
            assert cu != null
                : "ICompilerProject's dependency graph should be pinning all the compilation units in the collection.";
View Full Code Here

    {
        Collection<WeakReference<ICompilationUnit>> compilationUnitRefs = compilationUnitMap.getInvisible(sortKey, project);
        ArrayList<ICompilationUnit> compilationUnits = new ArrayList<ICompilationUnit>(compilationUnitRefs.size());
        for (WeakReference<ICompilationUnit> cuRef : compilationUnitRefs)
        {
            final ICompilationUnit cu = cuRef.get();
           
            // Nothing in the compiler pins the invisible compilation units
            // so we have to check that the weak reference is still good.
            if (cu != null)
            {
                assert cu.isInvisible()
                    : "StringToCompilationUnitMap.getInvisible returned a visible compilation unit.";
                compilationUnits.add(cu);
            }
        }
        return compilationUnits;
View Full Code Here

        {
            assert !cus.isEmpty();

            Iterator<ICompilationUnit> it = cus.iterator();

            ICompilationUnit cuKept = it.next(); // we are keeping the first one
            ICompilationUnit cuDumped = null;
            boolean somoneHasVisibleDefinitions = hasExternallyVisibleDefinitions(cuKept);

            while (it.hasNext()) // remove all the dupes from the list
            {
                cuDumped = it.next(); // Remember the last dupe to report it
                cuToWrite.remove(cuDumped);
                somoneHasVisibleDefinitions |= hasExternallyVisibleDefinitions(cuDumped);
            }

            // report a problem for dupe, unless none of the shadows has anything in it.
            if (cuDumped != null && somoneHasVisibleDefinitions)
            {
                problems.add(new DuplicateScriptProblem(cuKept.getAbsoluteFilename(), cuDumped.getAbsoluteFilename()));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.units.ICompilationUnit

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.