Package org.apache.flex.compiler.units

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


               
                // if we are not generating a system manager but have RSLs to load, generate
                // a warning.
                if (hasRSLs())
                {
                    final ICompilationUnit rootCompilationUnit = getRootClassCompilationUnit();
                    reportProblem(new MissingFactoryClassInFrameMetadataProblem(rootCompilationUnit.getAbsoluteFilename()));
                }
            }
           
            assert applicationSWFFrame != null;
            // Classes only reachable from CSS will end up in this
View Full Code Here


                problems.add(problem);
            }
            else
            {
                assert (defs != null && defs.length <= 1) : "Lookups using a fully qualified name should find at most 1 definition";
                ICompilationUnit referencedCU = projectScope.getCompilationUnitForScope(defs[0].getContainingScope());
                DependencyTypeSet dependencyTypes = DependencyTypeSet.copyOf(dependencyEntry.getValue());
                getProject().addDependency(this, referencedCU, dependencyTypes, defs[0].getQualifiedName());
            }
        }
View Full Code Here

            accessibleClassNames.add(accessibilityClass);
           
            IDefinition accessibilityClassDefinition = ref.resolve(flexProject);
            if ((accessibilityClassDefinition != null) && (!accessibilityClassDefinition.isImplicit()))
            {
                ICompilationUnit cu = flexProject.getScope().getCompilationUnitForDefinition(accessibilityClassDefinition);
                assert cu != null : "Unable to find compilation unit for definition!";
                accessibleCompilationUnits.add(cu);
            }
        }
       
View Full Code Here

            }
        }
        FlexJSProject project = (FlexJSProject) getMXMLWalker().getProject();
        ASProjectScope projectScope = (ASProjectScope) project.getScope();
        IDefinition cdef = node.getDefinition();
        ICompilationUnit cu = projectScope
                .getCompilationUnitForDefinition(cdef);
        ArrayList<String> deps = project.getRequires(cu);

        if (deps != null)
        {
            for (String imp : deps)
            {
                if (imp.indexOf(JSGoogEmitterTokens.AS3.getToken()) != -1)
                    continue;
   
                if (imp.equals(cname))
                    continue;
   
                if (imp.equals("mx.binding.Binding"))
                    continue;
                if (imp.equals("mx.binding.BindingManager"))
                    continue;
                if (imp.equals("mx.binding.FunctionReturnWatcher"))
                    continue;
                if (imp.equals("mx.binding.PropertyWatcher"))
                    continue;
                if (imp.equals("mx.binding.StaticPropertyWatcher"))
                    continue;
                if (imp.equals("mx.binding.XMLWatcher"))
                    continue;
                if (imp.equals("mx.events.PropertyChangeEvent"))
                    continue;
                if (imp.equals("mx.events.PropertyChangeEventKind"))
                    continue;
                if (imp.equals("mx.core.DeferredInstanceFromFunction"))
                    continue;
   
                if (NativeUtils.isNative(imp))
                    continue;
   
                if (writtenInstances.indexOf(imp) == -1)
                {
                    emitHeaderLine(imp);
                    writtenInstances.add(imp);
                }
            }
        }

        String s = ((MXMLFlexJSBlockWalker)getMXMLWalker()).encodedCSS;
        if (!s.isEmpty())
        {
            int reqidx = s.indexOf("goog.require");
            if (reqidx != -1)
            {
                String reqs = s.substring(reqidx);
                writeNewline(reqs);
            }
        }

        // erikdebruin: Add missing language feature support, like the 'is' and
        //              'as' operators. We don't need to worry about requiring
        //              this in every project: ADVANCED_OPTIMISATIONS will NOT
        //              include any of the code if it is not used in the project.
        if (project.mainCU != null &&
                cu.getName().equals(project.mainCU.getName()))
        {
            emitHeaderLine(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
        }

        writeNewline();
View Full Code Here

        if (project == null)
            project = getWalker().getProject();

        FlexJSProject flexProject = (FlexJSProject) project;
        ASProjectScope projectScope = (ASProjectScope) flexProject.getScope();
        ICompilationUnit cu = projectScope
                .getCompilationUnitForDefinition(type);
        ArrayList<String> requiresList = flexProject.getRequires(cu);
        ArrayList<String> interfacesList = flexProject.getInterfaces(cu);

        String cname = type.getQualifiedName();
        ArrayList<String> writtenInstances = new ArrayList<String>();
        writtenInstances.add(cname); // make sure we don't add ourselves

        boolean emitsRequires = false;
        if (requiresList != null)
        {
            for (String imp : requiresList)
            {
                if (imp.indexOf(JSGoogEmitterTokens.AS3.getToken()) != -1)
                    continue;

                if (imp.equals(cname))
                    continue;

                if (NativeUtils.isNative(imp))
                    continue;

                if (writtenInstances.indexOf(imp) == -1)
                {

                    /* goog.require('x');\n */
                    write(JSGoogEmitterTokens.GOOG_REQUIRE);
                    write(ASEmitterTokens.PAREN_OPEN);
                    write(ASEmitterTokens.SINGLE_QUOTE);
                    write(imp);
                    write(ASEmitterTokens.SINGLE_QUOTE);
                    write(ASEmitterTokens.PAREN_CLOSE);
                    writeNewline(ASEmitterTokens.SEMICOLON);
                   
                    writtenInstances.add(imp);
                   
                    emitsRequires = true;
                }
            }
        }
       
        boolean emitsInterfaces = false;
        if (interfacesList != null)
        {
            for (String imp : interfacesList)
            {
                write(JSGoogEmitterTokens.GOOG_REQUIRE);
                write(ASEmitterTokens.PAREN_OPEN);
                write(ASEmitterTokens.SINGLE_QUOTE);
                write(imp);
                write(ASEmitterTokens.SINGLE_QUOTE);
                write(ASEmitterTokens.PAREN_CLOSE);
                writeNewline(ASEmitterTokens.SEMICOLON);
               
                emitsInterfaces = true;
            }
        }
       
        // erikdebruin: Add missing language feature support, with e.g. 'is' and
        //              'as' operators. We don't need to worry about requiring
        //              this in every project: ADVANCED_OPTIMISATIONS will NOT
        //              include any of the code if it is not used in the project.
        boolean isMainCU = flexProject.mainCU != null &&
                    cu.getName().equals(flexProject.mainCU.getName());
        if (isMainCU)
        {
            write(JSGoogEmitterTokens.GOOG_REQUIRE);
            write(ASEmitterTokens.PAREN_OPEN);
            write(ASEmitterTokens.SINGLE_QUOTE);
View Full Code Here

        BuiltCompilationUnitSet builtCompilationUnits = getBuiltCompilationUnitSet();

        //        if (JSSharedData.OUTPUT_ISOLATED)
        //        {
        final ICompilationUnit rootCU = getRootClassCompilationUnit();
        compilationUnits.clear();
        compilationUnits.add(rootCU);

        // i added
        Iterables.addAll(problems, builtCompilationUnits.problems);
View Full Code Here

                                .getQualifiedNames().get(0), outputFolder);

                        System.out
                                .println("Compiling file: " + outputClassFile);

                        ICompilationUnit unit = cu;

                        IASWriter writer;
                        if (cuType == ICompilationUnit.UnitType.AS_UNIT)
                        {
                            writer = JSSharedData.backend.createWriter(project,
View Full Code Here

                else
                    problems.add(new NoSourceForClassInNamespaceProblem(namespace, reference.getDisplayString()));
            }
            else
            {
                ICompilationUnit defCU = project.getScope().getCompilationUnitForDefinition(def);
                if (defCU == null)
                    problems.add(new NoCompilationUnitForDefinitionProblem(def.getBaseName()));
                else
                    units.add(defCU);
            }
View Full Code Here

    IMXMLNamespaceMapping mxml2009 = new MXMLNamespaceMapping(
        "http://ns.adobe.com/mxml/2009", env.SDK + "\\frameworks\\mxml-2009-manifest.xml");
    namespaceMappings.add(mxml2009);
    project.setNamespaceMappings(namespaceMappings);
       
    ICompilationUnit cu = null;
        String normalizedMainFileName = FilenameNormalization.normalize(tempMXMLFile.getAbsolutePath());
    //String normalizedMainFileName = FilenameNormalization.normalize("code.mxml");
        SourceCompilationUnitFactory compilationUnitFactory = project.getSourceCompilationUnitFactory();
        File normalizedMainFile = new File(normalizedMainFileName);
        if (compilationUnitFactory.canCreateCompilationUnit(normalizedMainFile))
        {
            Collection<ICompilationUnit> mainFileCompilationUnits = workspace.getCompilationUnits(normalizedMainFileName, project);
            for (ICompilationUnit cu2 : mainFileCompilationUnits)
            {
              if (cu2 != null)
                cu = cu2;
            }
        }
   
        // Build the AST.
    IMXMLFileNode fileNode = null;
    try
    {
      fileNode = (IMXMLFileNode)cu.getSyntaxTreeRequest().get().getAST();
    }
    catch (InterruptedException e)
    {
      e.printStackTrace();
    }
View Full Code Here

                .normalize(tempFile.getAbsolutePath());

        Collection<ICompilationUnit> mainFileCompilationUnits = workspace
                .getCompilationUnits(normalizedMainFileName, project);

        ICompilationUnit cu = null;
        for (ICompilationUnit cu2 : mainFileCompilationUnits)
        {
            if (cu2 != null)
                cu = cu2;
        }

        IASNode fileNode = null;
        try
        {
            fileNode = cu.getSyntaxTreeRequest().get().getAST();
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }
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.