Package org.apache.flex.compiler.tree.mxml

Examples of org.apache.flex.compiler.tree.mxml.IMXMLFileNode


    @Override
    public void getAllImportNodes(Collection<IImportNode> imports)
    {
        // Add implicit import nodes created by MXML tags.
        // The implicit imports for each MXML class are stored on its ClassDefinition.
        IMXMLFileNode fileNode = (IMXMLFileNode)getAncestorOfType(IMXMLFileNode.class);
        ICompilerProject project = fileNode.getCompilerProject();
        for (String qname : ((ClassDefinition)classDefinition).getImplicitImports())
        {
            imports.add(new MXMLImplicitImportNode(project, qname));
        }

        // Add the implicit import nodes associated with the file node.
        fileNode.getAllImportNodes(imports);

        // Add the explicit import nodes inside of <Script> tags.
        for (IMXMLScriptNode scriptNode : getScriptNodes())
        {
            for (IASNode node : scriptNode.getASNodes())
View Full Code Here


            IASNode asNode = getRootNode();
           
            if (!(asNode instanceof IMXMLFileNode))
                return null;
           
            IMXMLFileNode mxmlNode = (IMXMLFileNode)asNode;
            List<IEmbedResolver> embedNodes = mxmlNode.getEmbedNodes();
            for (IEmbedResolver node : embedNodes)
            {
               
                if (node instanceof IMXMLEmbedNode)
                {
View Full Code Here

        final MXMLTreeBuilder builder =
            new MXMLTreeBuilder(this, getFileSpecificationGetter(),  qname, mxmlData, fileScope, problems);

        // Use the MXMLTreeBuilder to build an MXMLFileNode (the root of an MXML AST)
        // from the MXMLData (the MXML DOM) and the MXMLFileScope.
        final IMXMLFileNode fileNode = builder.build();

        try
        {
            // TODO This belongs in MXMLDocumentNode.
            MXMLDocumentNode documentNode = (MXMLDocumentNode)fileNode.getDocumentNode();
            if (documentNode != null)
            {
                ClassDefinition mainClassDefinition = fileScope.getMainClassDefinition();
                if (mainClassDefinition != null)
                {
                    TypeScope mainClassScope = (TypeScope)mainClassDefinition.getContainedScope();
                    documentNode.setScope(mainClassScope);
                }
            }
           
            // Start CSS semantic analysis.
            final Function<IMXMLStyleNode, ICSSDocument> parseMXMLStyleNode = new Function<IMXMLStyleNode, ICSSDocument>()
            {
                @Override
                public ICSSDocument apply(IMXMLStyleNode mxmlStyleNode)
                {
                    // This method will trigger the CSS parser to parse the CSS fragment.
                    return mxmlStyleNode.getCSSDocument(problems);
                }
            };
            final Collection<ICSSDocument> cssDocumentList =
                    transform(fileNode.getStyleNodes(), parseMXMLStyleNode);

            // This method will resolve dependencies introduced by the CSS fragment, and add the
            // dependee's to the dependency graph. This is done at the last step in MXML tree
            // building phase.
            // - It can't be done in MXML semantic analysis, because MXML code generation doesn't
            //   depend on MXML semantic analysis;
            // - It can't be done in MXML code generation either, because the "problems" in that phase are
            //   generated from inside ABCGenerator.
            updateStyleCompilationUnitDependencies(
                    fileNode.getCSSCompilationSession(),
                    fileScope,
                    cssDocumentList,
                    problems);
           
            fileNode.getCSSCompilationSession().cssDocuments.addAll(cssDocumentList);
        }
        catch (Throwable e)
        {
            //something went wrong, so log it. 
            problems.add(new UnexpectedExceptionProblem(e));
        }
        finally
        {
            stopProfile(Operation.GET_SYNTAX_TREE);
        }

        return new SyntaxTreeRequestResult(fileNode, ImmutableSet.<String>copyOf(fileScope.getSourceDependencies()), fileNode.getIncludeTreeLastModified(), problems);
    }
View Full Code Here

    }

    private void setContainingSourceFilename()
    {
        // TODO Refactor this to avoid walking up to the file node.
        IMXMLFileNode fileNode = (IMXMLFileNode)getAncestorOfType(IMXMLFileNode.class);
        containingSourceFilename = FilenameNormalization.normalize(fileNode.getSourcePath());
    }
View Full Code Here

    @Override
    protected void initializationComplete(MXMLTreeBuilder builder, IMXMLTagData tag,
                                          MXMLNodeInfo info)
    {
        String path = builder.getPath();
        IMXMLFileNode fileNode = builder.getFileNode();
        processHandlerCode(builder, processUnitAsAS(
                builder, tag, path, scope, PostProcessStep.POPULATE_SCOPE, fileNode));
    }
View Full Code Here

*/
public class MXMLDeclarationsNodeTests extends MXMLNodeBaseTests
  private IMXMLDeclarationsNode getMXMLDeclarationsNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLDeclarationsNode node = (IMXMLDeclarationsNode)findFirstDescendantOfType(fileNode, IMXMLDeclarationsNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLDeclarationsID));
    assertThat("getName", node.getName(), is("Declarations"));
    return node;
  }
View Full Code Here

*/
public class MXMLArrayNodeTests extends MXMLInstanceNodeTests
{
  private IMXMLArrayNode getMXMLArrayNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLArrayNode node = (IMXMLArrayNode)findFirstDescendantOfType(fileNode, IMXMLArrayNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLArrayID));
    assertThat("getName", node.getName(), is("Array"));
    return node;
  }
View Full Code Here

*/
public class MXMLResourceNodeTests extends MXMLInstanceNodeTests
{
  private IMXMLResourceNode getMXMLResourceNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLResourceNode node = (IMXMLResourceNode)findFirstDescendantOfType(fileNode, IMXMLResourceNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLResourceID));
    assertThat("getName", node.getName(), is("Resource"));
    assertThat("getChildCount", node.getChildCount(), is(0));
    return node;
View Full Code Here

*/
public class MXMLVectorNodeTests extends MXMLInstanceNodeTests
{
  private IMXMLVectorNode getMXMLVectorNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLVectorNode node = (IMXMLVectorNode)findFirstDescendantOfType(fileNode, IMXMLVectorNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLVectorID));
    assertThat("getName", node.getName(), is("Vector"));
    return node;
  }
View Full Code Here

*/
public class MXMLRegExpNodeTests extends MXMLExpressionNodeBaseTests
{
  private IMXMLRegExpNode getMXMLRegExpNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLRegExpNode node = (IMXMLRegExpNode)findFirstDescendantOfType(fileNode, IMXMLRegExpNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLRegExpID));
    assertThat("getName", node.getName(), is("RegExp"));
    return node;
  }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.mxml.IMXMLFileNode

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.