Examples of MXMLFileScope


Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

                ICompilerProblem problem = new MXMLSemanticProblem(childTag);
                builder.addProblem(problem);
            }

            // Find the ClassDefinition that was created for the component class.
            MXMLFileScope fileScope = builder.getFileScope();
            ClassDefinition fxComponentClassDefinition =
                    fileScope.getClassDefinitionForComponentTag(tag);

            assert fxComponentClassDefinition != null : "MXMLScopeBuilder failed to build a class for an fx:Component";

            // attach scope with the component class definition node.
            TypeScope componentClassScope = (TypeScope)fxComponentClassDefinition.getContainedScope();
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

    @Override
    protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
                                   IMXMLTagData childTag,
                                   MXMLNodeInfo info)
    {
        MXMLFileScope fileScope = builder.getFileScope();

        MXMLNodeBase childNode = null;

        if (fileScope.isDefinitionTag(childTag))
            childNode = new MXMLDefinitionNode(this);
        else
            super.processChildTag(builder, tag, childTag, info);

        if (childNode != null)
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

    @Override
    protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
                                   IMXMLTagData childTag,
                                   MXMLNodeInfo info)
    {
        MXMLFileScope fileScope = builder.getFileScope();

        MXMLNodeBase childNode = null;

        if (fileScope.isDeclarationsTag(childTag))
        {
            childNode = new MXMLDeclarationsNode(this);
        }
        else if ((fileScope.isScriptTag(childTag)) &&
                 // Our base class will handle script tags for MXML 2009 and below.
                 // Beginning with MXML 2012, only class definition tags may have script
                 // tags as children.
                 (builder.getMXMLDialect().isEqualToOrAfter(MXMLDialect.MXML_2012)))
        {
            childNode = new MXMLScriptNode(this);
        }
        else if (fileScope.isStyleTag(childTag))
        {
            childNode = new MXMLStyleNode(this);
        }
        else if (fileScope.isMetadataTag(childTag))
        {
            childNode = new MXMLMetadataNode(this);
        }
        else if (fileScope.isBindingTag(childTag))
        {
            childNode = new MXMLBindingNode(this);
            this.setHasDataBindings(); // we must have some, if we made this node
        }
        else
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

    @Override
    protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
                                   IMXMLTagData childTag,
                                   MXMLNodeInfo info)
    {
        MXMLFileScope fileScope = builder.getFileScope();

        if (fileScope.isComponentTag(childTag))
        {
            MXMLComponentNode componentNode = new MXMLComponentNode(this);
            componentNode.initializeFromTag(builder, childTag);
            info.addChildNode(componentNode);
        }
        else if (fileScope.isModelTag(childTag))
        {
            MXMLModelNode modelNode = new MXMLModelNode(this);
            modelNode.initializeFromTag(builder, childTag);
            info.addChildNode(modelNode);
        }
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

     * Translates the node's start and end offset from local to absolute
     * offsets.
     */
    public void adjustOffsets(MXMLTreeBuilder builder)
    {
        final MXMLFileScope fileScope = builder.getFileScope();
        assert fileScope != null : "Expected MXMLFileScope.";

        final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
        assert offsetLookup != null : "Expected OffsetLookup on file scope.";

        final String path = getFileSpecification().getPath(); // TODO Get from builder?

        final int absoluteStart = offsetLookup.getAbsoluteOffset(path, getAbsoluteStart())[0];
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

            return sourcePath;
        }

        public ISourceFragment[] getSourceFragments()
        {
            final MXMLFileScope fileScope = builder.getFileScope();
            final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
            assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
            for (ISourceFragment fragment : sourceFragmentList)
            {
                int physicalStart = fragment.getPhysicalStart();
                final int[] absoluteOffsets = offsetLookup.getAbsoluteOffset(sourcePath, physicalStart);
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

                if (scriptText != null)
                {
                    final IncludeHandler includeHandler = new IncludeHandler(builder.getFileSpecificationGetter());
                    includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());
                    includeHandler.enterFile(sourcePath);
                    final MXMLFileScope fileScope = builder.getFileScope();
                    final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
                    assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
                    final int[] absoluteOffset = offsetLookup.getAbsoluteOffset(sourcePath, 0);

                    final ScopedBlockNode fragment = ASParser.parseFragment2(
                            scriptText,
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

    @Override
    protected ISyntaxTreeRequestResult handleSyntaxTreeRequest() throws InterruptedException
    {
        // Fulfill other requests before profiling this request.      
        final IFileScopeRequestResult fileScopeRequestResult = getFileScopeRequest().get();
        final MXMLFileScope fileScope = (MXMLFileScope)fileScopeRequestResult.getScopes()[0];
       
        startProfile(Operation.GET_SYNTAX_TREE);
       
        final IMXMLData mxmlData = getMXMLData();
       
        final Collection<ICompilerProblem> problems = new HashSet<ICompilerProblem>();
       
        // Create an MXMLTreeBuilder to store all the contextual information
        // that we need to build an MXML tree.
        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

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

        try
        {
            final IMXMLData mxmlData = getMXMLData();
                   
            final MXMLScopeBuilder scopeBuilder = new MXMLScopeBuilder(this, getFileSpecificationGetter(), mxmlData, qname, getAbsoluteFilename());
            MXMLFileScope fileScope = scopeBuilder.build();
            final ImmutableList<OffsetCue> offsetCueList = scopeBuilder.getIncludeHandler().getOffsetCueList();
            final OffsetLookup offsetLookup = new OffsetLookup(offsetCueList);
            fileScope.setOffsetLookup(offsetLookup);
            final Collection<ICompilerProblem> problemCollection = scopeBuilder.getProblems();
            final IFileSpecification rootFileSpec = getRootFileSpecification();

            getProject().getWorkspace().addIncludedFilesToCompilationUnit(this, fileScope.getSourceDependencies());

            return new ASFileScopeRequestResult(getDefinitionPromises(), getDefinitionPriority(), problemCollection, fileScope, rootFileSpec);
        }
        finally
        {
View Full Code Here

Examples of org.apache.flex.compiler.internal.scopes.MXMLFileScope

        this.mxmlData = mxmlData;
       
        this.qname = qname;

        fileScope = new MXMLFileScope(compilationUnit, fileName, mxmlData);
        String packageName = Multiname.getPackageNameForQName(qname);
        packageScope = new PackageScope(fileScope, packageName);
        packageScope.setContainingScope(fileScope);
        PackageDefinition packageDefinition = new PackageDefinition(packageName);
        // CMP-742: packages created for MXML scopes should be marked implicit
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.