Package flex2.compiler

Examples of flex2.compiler.CompilationUnit


            interfaceInfo = interfaceInfoMap.get( qName.toString() );

            if (interfaceInfo == null)
            {
                CompilationUnit compilationUnit = source.getCompilationUnit();

                if (compilationUnit != null)
                {
                    AbcClass abcClass = compilationUnit.classTable.get( qName.toString() );
View Full Code Here


            {
                Source source = symbolTable.findSourceByQName(qName);

                assert source != null : "no source for qname '" + qName + "', even though multiname was resolved";

                CompilationUnit compilationUnit = source.getCompilationUnit();

                AbcClass abcClass = compilationUnit.classTable.get( qName.toString() );

                if (abcClass != null)
                {
View Full Code Here

            InterfaceInfo baseInterfaceInfo = interfaceInfoMap.get( qName.toString() );

            if (baseInterfaceInfo == null)
            {
                CompilationUnit compilationUnit = source.getCompilationUnit();

                AbcClass abcClass = null;

                if (compilationUnit != null)
                {
View Full Code Here

        if (syntaxTree != null)
        {
            if (!(syntaxTree instanceof Node))
            {
                flex2.compiler.CompilerContext context = compilationUnit.getContext();
                CompilationUnit delegateUnit =
                    (CompilationUnit) context.getAttribute(DELEGATE_UNIT);
                // delegateUnit can be null in the case of an error, like base class not
                // found.
                if (delegateUnit != null)
                {
                    result = (Node) delegateUnit.getSyntaxTree();
                }
            }
            else
            {
                result = (Node) syntaxTree;
View Full Code Here

    public CompilationUnit parse1(Source source, SymbolTable symbolTable)
    {
        if (benchmarkHelper != null)
            benchmarkHelper.startPhase(CompilerBenchmarkHelper.PARSE1, source.getNameForReporting());

        CompilationUnit unit = source.getCompilationUnit();

        if (unit != null && unit.hasTypeInfo)
        {
            return unit;
        }
View Full Code Here

         * </p>
         */
        public CompilationUnit parse1(Source source, SymbolTable symbolTable)
        {
            CompilerContext context = new CompilerContext();
            CompilationUnit unit = source.newCompilationUnit(null, context);

            // Setup a logger to bridge FXG and Flex logging systems
            setupLogger();

            // Setup the FXG Parser using either the mobile or desktop profile
View Full Code Here

                ThreadLocalToolkit.log(new SourceGenerationException(ex), originalSource);
                return;
            }

            // Compile our generated source with ASC
            CompilationUnit interfaceUnit = delegateSubCompiler.parse1(generatedSource, symbolTable);

            if (interfaceUnit != null)
            {
                unit.getSource().addFileIncludes(interfaceUnit.getSource());
                unit.getContext().setAttribute(DELEGATE_UNIT, interfaceUnit);

                //TODO: Establish FXG -> generated ActionScript line number map
                //unit.getContext().setAttribute(LINE_NUMBER_MAP, lineNumberMap);
View Full Code Here

    CompilerContext context = new CompilerContext();

        // 1. parse/analyze MXML, or retrieve preparsed DOM
        // 2. add MXML syntax tree to a new CompilationUnit
        DocumentNode app;
        CompilationUnit unit;

        Object preparsedSyntaxTree = source.getSourceFragment(AttrInlineComponentSyntaxTree);
        if (preparsedSyntaxTree == null)
        {
            app = parseMXML(source);
            if (app == null)
            {
                return null;
            }

            unit = source.newCompilationUnit(app, context);

            // do more syntax checking, chase includes, etc.
            app.analyze(new SyntaxAnalyzer(unit, mxmlConfiguration));
            if (ThreadLocalToolkit.errorCount() > 0)
            {
                return null;
            }
        }
        else
        {
            assert preparsedSyntaxTree instanceof DocumentNode : "bogus preparsed root node passed to InterfaceCompiler";
            app = (DocumentNode) preparsedSyntaxTree;
            unit = source.newCompilationUnit(app, context);
        }

        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

      map.setNewName(newSource.getName());
    }

    //  use ASC to produce new CU for generated interface source. Will be managed by "outer" MXML CU
    CompilationUnit interfaceUnit = compileInterface(newSource, source, docInfo, map, symbolTable);

    if (interfaceUnit != null)
    {
      //  transfer includes from the interface unit to the real MXML unit
      unit.getSource().addFileIncludes(interfaceUnit.getSource());

            //  InterfaceUnit, LineNumberMap are used in subsequent phases of InterfaceCompiler
            unit.getContext().setAttribute(MxmlCompiler.LINE_NUMBER_MAP, map);
            unit.getContext().setAttribute(MxmlCompiler.DELEGATE_UNIT, interfaceUnit);
View Full Code Here

    /**
     * run asc.analyze1() on unit's private AS unit representing the public signature, shuttling results back to outer unit
     */
    public void analyze1(CompilationUnit unit, SymbolTable symbolTable)
    {
    CompilationUnit interfaceUnit = (CompilationUnit) unit.getContext().getAttribute(MxmlCompiler.DELEGATE_UNIT);

    Logger original = setLogAdapter(unit);
        asc.analyze1(interfaceUnit, symbolTable);
        ThreadLocalToolkit.setLogger(original);

View Full Code Here

TOP

Related Classes of flex2.compiler.CompilationUnit

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.