Package flex2.compiler.mxml.rep

Examples of flex2.compiler.mxml.rep.DocumentInfo


            typeTable = new TypeTable(symbolTable, nameMappings, unit.getStandardDefs(),
                                      mxmlConfiguration.getThemeNames());
            symbolTable.getContext().setAttribute(MxmlCompiler.TYPE_TABLE, typeTable);
        }

        DocumentInfo info = (DocumentInfo)unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
        @SuppressWarnings("unchecked")
        Set<Node> checkNodes = (Set<Node>)unit.getContext().getAttribute(MxmlCompiler.CHECK_NODES);
       
        @SuppressWarnings("unchecked")
        Set<MultiName> allTypeRequests = (Set<MultiName>)unit.getContext().getAttribute(AttrTypeRequests);

        if (checkNodes == null)
        {
            //  first call to postprocess

            //  seed checkNodes with root node
            checkNodes = new HashSet<Node>();
            checkNodes.add(info.getRootNode());

            //  set up type request record - apparently unit.expressions gets scrubbed of multinames that fail to resolve?
            allTypeRequests = new HashSet<MultiName>();
            unit.getContext().setAttribute(AttrTypeRequests, allTypeRequests);
        }
View Full Code Here


     * <p>InterfaceAnalyzer then adds additional stuff from the DOM, prior to interface codegen
     */
    private DocumentInfo createDocumentInfo(CompilationUnit unit, DocumentNode app, Source source)
    {
        StandardDefs standardDefs = unit.getStandardDefs();
        DocumentInfo info = new DocumentInfo(source.getNameForReporting(), standardDefs);

        //  set MXML root
        info.setRootNode(app, app.beginLine);
       
        //  package/class is derived from source name and location
        info.setClassName(source.getShortName());
        info.setPackageName(source.getRelativePath().replace('/','.'));

        //  superclass is derived from root node name

        // first, check to see if the base class is a local class
        String superClassName = info.getLocalClass(app.getNamespace(), app.getLocalPart());

        // otherwise, check the usual manifest mappings
        if (superClassName == null)
            superClassName = nameMappings.resolveClassName(app.getNamespace(), app.getLocalPart());

        if (superClassName != null)
        {
            info.setQualifiedSuperClassName(NameFormatter.toDot(superClassName), app.beginLine);
        }
        else
        {
            ThreadLocalToolkit.log(new AnalyzerAdapter.CouldNotResolveToComponent(app.image), source, app.beginLine);
            return null;
        }

        //  interfaces specified by "implements" attribute.
        //  TODO "implements" is language def, it should be in a list of language constants somewhere
        String interfaceNames = (String) app.getAttributeValue("implements");
        if (interfaceNames != null)
        {
            StringTokenizer t = new StringTokenizer(interfaceNames, ",");
            while (t.hasMoreTokens())
            {
                info.addInterfaceName(t.nextToken().trim(), app.getLineNumber("implements"));
            }
        }

        //  seed import name set with the unconditional imports present in all generated MXML classes
        if (mxmlConfiguration.getGenerateAbstractSyntaxTree())
        {
            info.addSplitImportNames(StandardDefs.splitImplicitImports);

            // See SDK-16946
            if (info.getVersion() >= 4)
            {
                info.removeSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
                info.addSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS),
                                        StandardDefs.splitPackageMxFilters);
            }

            if (mxmlConfiguration.getCompilingForAIR())
            {
                info.addSplitImportNames(StandardDefs.splitAirOnlyImplicitImports);
            }

            info.addSplitImportNames(standardDefs.getSplitStandardMxmlImports());
        }
        else
        {
            info.addImportNames(StandardDefs.implicitImports, app.beginLine);

            // See SDK-16946
            if (info.getVersion() >= 4)
            {
                info.removeImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
                info.addImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS), app.beginLine);
            }

            if (mxmlConfiguration.getCompilingForAIR())
            {
                info.addImportNames(StandardDefs.airOnlyImplicitImports, app.beginLine);
            }

            info.addImportNames(standardDefs.getStandardMxmlImports(), app.beginLine);
        }

        return info;
    }
View Full Code Here

    }

    DocumentNode app = (DocumentNode)unit.getSyntaxTree();
    assert app != null;

    DocumentInfo info = (DocumentInfo)unit.getContext().removeAttribute(MxmlCompiler.DOCUMENT_INFO);
    assert info != null;

    //  build MxmlDocument from MXML DOM
    MxmlDocument document = new MxmlDocument(unit, typeTable, info, mxmlConfiguration);
        DocumentBuilder builder = new DocumentBuilder(unit, typeTable, mxmlConfiguration, document);
View Full Code Here

        }

        unit.getContext().setAttribute(DOCUMENT_NODE, app);

        //  start a new DocumentInfo. this will accumulate document state as compilation proceeds
        DocumentInfo docInfo = createDocumentInfo(unit, app, source);
        if (ThreadLocalToolkit.errorCount() > 0)
        {
            return null;
        }

        unit.getContext().setAttribute(MxmlCompiler.DOCUMENT_INFO, docInfo);
        unit.topLevelDefinitions.add(new QName(docInfo.getPackageName(), docInfo.getClassName()));
        transferDependencies(docInfo, unit.inheritance, unit.inheritanceHistory);

        return unit;
    }
View Full Code Here

        return unit;
    }
   
    public void parse2(CompilationUnit unit, SymbolTable symbolTable)
    {
    DocumentInfo docInfo = (DocumentInfo) unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
        Source source = unit.getSource();

        //  get parsed superclass info - NOTE may be null in case of error
        ClassInfo baseClassInfo = getClassInfo(source, symbolTable, docInfo.getQualifiedSuperClassName());
        if (baseClassInfo == null && docInfo.getQualifiedSuperClassName() != null)
        {
            String qualifiedClassName = NameFormatter.toDot(docInfo.getPackageName(), docInfo.getClassName());
            ThreadLocalToolkit.log(new BaseClassNotFound(qualifiedClassName, docInfo.getQualifiedSuperClassName()), source);
            return;
        }

        //  InterfaceAnalyzer will collect items to be included in generated interface code, and add them to info
        InterfaceAnalyzer analyzer = new InterfaceAnalyzer(unit, docInfo, baseClassInfo, mxmlConfiguration.getGenerateAbstractSyntaxTree());
View Full Code Here

            typeTable = new TypeTable(symbolTable, nameMappings, unit.getStandardDefs(),
                                      mxmlConfiguration.getThemeNames());
            symbolTable.getContext().setAttribute(MxmlCompiler.TYPE_TABLE, typeTable);
        }

        DocumentInfo info = (DocumentInfo)unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
        @SuppressWarnings("unchecked")
        Set<Node> checkNodes = (Set<Node>)unit.getContext().getAttribute(MxmlCompiler.CHECK_NODES);
       
        @SuppressWarnings("unchecked")
        Set<MultiName> allTypeRequests = (Set<MultiName>)unit.getContext().getAttribute(AttrTypeRequests);

        if (checkNodes == null)
        {
            //  first call to postprocess

            //  seed checkNodes with root node
            checkNodes = new HashSet<Node>();
            checkNodes.add(info.getRootNode());

            //  set up type request record - apparently unit.expressions gets scrubbed of multinames that fail to resolve?
            allTypeRequests = new HashSet<MultiName>();
            unit.getContext().setAttribute(AttrTypeRequests, allTypeRequests);
        }
View Full Code Here

     * <p>InterfaceAnalyzer then adds additional stuff from the DOM, prior to interface codegen
     */
    private DocumentInfo createDocumentInfo(CompilationUnit unit, DocumentNode app, Source source)
    {
        StandardDefs standardDefs = unit.getStandardDefs();
        DocumentInfo info = new DocumentInfo(source.getNameForReporting(), standardDefs);

        //  set MXML root
        info.setRootNode(app, app.beginLine);
       
        //  package/class is derived from source name and location
        info.setClassName(source.getShortName());
        info.setPackageName(source.getRelativePath().replace('/','.'));

        //  superclass is derived from root node name

        // first, check to see if the base class is a local class
        String superClassName = info.getLocalClass(app.getNamespace(), app.getLocalPart());

        // otherwise, check the usual manifest mappings
        if (superClassName == null)
            superClassName = nameMappings.resolveClassName(app.getNamespace(), app.getLocalPart());

        if (superClassName != null)
        {
            info.setQualifiedSuperClassName(NameFormatter.toDot(superClassName), app.beginLine);
        }
        else
        {
            ThreadLocalToolkit.log(new AnalyzerAdapter.CouldNotResolveToComponent(app.image), source, app.beginLine);
            return null;
        }

        //  interfaces specified by "implements" attribute.
        //  TODO "implements" is language def, it should be in a list of language constants somewhere
        String interfaceNames = (String) app.getAttributeValue("implements");
        if (interfaceNames != null)
        {
            StringTokenizer t = new StringTokenizer(interfaceNames, ",");
            while (t.hasMoreTokens())
            {
                info.addInterfaceName(t.nextToken().trim(), app.getLineNumber("implements"));
            }
        }

        //  seed import name set with the unconditional imports present in all generated MXML classes
        if (mxmlConfiguration.getGenerateAbstractSyntaxTree())
        {
            info.addSplitImportNames(StandardDefs.splitImplicitImports);

            // See SDK-16946
            if (info.getVersion() >= 4)
            {
                info.removeSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
                info.addSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS),
                                        StandardDefs.splitPackageMxFilters);
            }

            if (mxmlConfiguration.getCompilingForAIR())
            {
                info.addSplitImportNames(StandardDefs.splitAirOnlyImplicitImports);
            }

            info.addSplitImportNames(standardDefs.getSplitStandardMxmlImports());
        }
        else
        {
            info.addImportNames(StandardDefs.implicitImports, app.beginLine);

            // See SDK-16946
            if (info.getVersion() >= 4)
            {
                info.removeImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
                info.addImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS), app.beginLine);
            }

            if (mxmlConfiguration.getCompilingForAIR())
            {
                info.addImportNames(StandardDefs.airOnlyImplicitImports, app.beginLine);
            }

            info.addImportNames(standardDefs.getStandardMxmlImports(), app.beginLine);
        }

        return info;
    }
View Full Code Here

        }

        unit.getContext().setAttribute(DOCUMENT_NODE, app);

        //  start a new DocumentInfo. this will accumulate document state as compilation proceeds
        DocumentInfo docInfo = createDocumentInfo(unit, app, source);
        if (ThreadLocalToolkit.errorCount() > 0)
        {
            return null;
        }

        unit.getContext().setAttribute(MxmlCompiler.DOCUMENT_INFO, docInfo);
        unit.topLevelDefinitions.add(new QName(docInfo.getPackageName(), docInfo.getClassName()));
        transferDependencies(docInfo, unit.inheritance, unit.inheritanceHistory);

        return unit;
    }
View Full Code Here

        return unit;
    }
   
    public void parse2(CompilationUnit unit, SymbolTable symbolTable)
    {
    DocumentInfo docInfo = (DocumentInfo) unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
        Source source = unit.getSource();

        //  get parsed superclass info - NOTE may be null in case of error
        ClassInfo baseClassInfo = getClassInfo(source, symbolTable, docInfo.getQualifiedSuperClassName());
        if (baseClassInfo == null && docInfo.getQualifiedSuperClassName() != null)
        {
            String qualifiedClassName = NameFormatter.toDot(docInfo.getPackageName(), docInfo.getClassName());
            ThreadLocalToolkit.log(new BaseClassNotFound(qualifiedClassName, docInfo.getQualifiedSuperClassName()), source);
            return;
        }

        //  InterfaceAnalyzer will collect items to be included in generated interface code, and add them to info
        InterfaceAnalyzer analyzer = new InterfaceAnalyzer(unit, docInfo, baseClassInfo, mxmlConfiguration.getGenerateAbstractSyntaxTree());
View Full Code Here

            typeTable = new TypeTable(symbolTable, nameMappings, unit.getStandardDefs(),
                                      mxmlConfiguration.getThemeNames());
            symbolTable.getContext().setAttribute(MxmlCompiler.TYPE_TABLE, typeTable);
        }

        DocumentInfo info = (DocumentInfo)unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
        @SuppressWarnings("unchecked")
        Set<Node> checkNodes = (Set<Node>)unit.getContext().getAttribute(MxmlCompiler.CHECK_NODES);
       
        @SuppressWarnings("unchecked")
        Set<MultiName> allTypeRequests = (Set<MultiName>)unit.getContext().getAttribute(AttrTypeRequests);

        if (checkNodes == null)
        {
            //  first call to postprocess

            //  seed checkNodes with root node
            checkNodes = new HashSet<Node>();
            checkNodes.add(info.getRootNode());

            //  set up type request record - apparently unit.expressions gets scrubbed of multinames that fail to resolve?
            allTypeRequests = new HashSet<MultiName>();
            unit.getContext().setAttribute(AttrTypeRequests, allTypeRequests);
        }
View Full Code Here

TOP

Related Classes of flex2.compiler.mxml.rep.DocumentInfo

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.