Package flex2.compiler

Examples of flex2.compiler.CompilerContext


    ProgramNode node = (ProgramNode) unit.getSyntaxTree();
    if (node.state != ProgramNode.Else)
    {
      return;
    }
    CompilerContext context = unit.getContext();
    Context cx = context.getAscContext();
    symbolTable.perCompileData.handler = cx.getHandler();

    FlowAnalyzer flower = (FlowAnalyzer) context.getAttribute("FlowAnalyzer");
    context.setAttribute("processed", new HashSet(15));

    inheritSlots(unit, unit.inheritance, symbolTable);
    inheritSlots(unit, unit.namespaces, symbolTable);

    cx.pushScope(node.frame);
View Full Code Here


      return;
    }

    ProgramNode node = (ProgramNode) unit.getSyntaxTree();

    CompilerContext context = unit.getContext();
    Context cx = context.getAscContext();
    symbolTable.perCompileData.handler = cx.getHandler();

    inheritSlots(unit, unit.types, symbolTable);
    inheritSlots(unit, unit.namespaces, symbolTable);

    // run ConstantEvaluator
    cx.pushScope(node.frame);
    ConstantEvaluator analyzer = new ConstantEvaluator(cx);
    analyzer.PreprocessDefinitionTypeInfo(cx, node);
    cx.popScope();
    context.setAttribute("ConstantEvaluator", analyzer);

    if (ThreadLocalToolkit.errorCount() > 0)
    {
        return;
    }
View Full Code Here

      return;
    }

    ProgramNode node = (ProgramNode) unit.getSyntaxTree();

    CompilerContext context = unit.getContext();
    Context cx = context.getAscContext();
    symbolTable.perCompileData.handler = cx.getHandler();

    // run ConstantEvaluator
    cx.pushScope(node.frame);
    ConstantEvaluator analyzer = (ConstantEvaluator) context.removeAttribute("ConstantEvaluator");
    node.evaluate(cx, analyzer);
    cx.popScope();

    if (ThreadLocalToolkit.errorCount() > 0)
    {
View Full Code Here

  {
  }

    private void inheritSlots(CompilationUnit unit, Set<Name> types, SymbolTable symbolTable)
  {
    CompilerContext context = unit.getContext();
    ProgramNode node = (ProgramNode) unit.getSyntaxTree();
   
    Context cx = context.getAscContext();
       
    @SuppressWarnings("unchecked")
    Set<String> processed = (Set<String>) context.getAttribute("processed");

    for (Name name : types)
    {
      if (name instanceof flex2.compiler.util.QName)
      {
View Full Code Here

     * Do basic MXML parse, generate AS containing public signature contributors, and parse that using our ASC instance.
     * Result will be "outer" compilation unit, with the unit returned by ASC stashed in a context attribute.
     */
    public CompilationUnit parse1(Source source, SymbolTable symbolTable)
    {
    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;
View Full Code Here

                                     symbolTable.perCompileData,
                                     result,
                                     symbolTable.emitter,
                                                                       ascConfiguration.getDefine());

    CompilerContext context = new CompilerContext();
    context.setAscContext(interfaceGenerator.getContext());

    Object syntaxTree = interfaceGenerator.getSyntaxTree();
    result.newCompilationUnit(syntaxTree, context).setSyntaxTree(syntaxTree);

    return result;
View Full Code Here

        // SWC. The polluted symbol table then causes the
        // BindableSecondPassEvaluator to assume the class does not already
        // implement IEventDispatcher. See SDK-25312
        if (unit.hostComponentMetaData != null)
        {
            CompilerContext context = unit.getContext();
            Context cx = (Context) context.getAscContext();
            TypeAnalyzer typeAnalyzer = typeTable.getSymbolTable().getTypeAnalyzer();
            generateHostComponentVariable(cx, unit, typeAnalyzer);
        }
    }
View Full Code Here

    public void generate(CompilationUnit unit, TypeTable typeTable)
    {
        if (unit.hostComponentMetaData != null)
        {
            CompilerContext context = unit.getContext();
            Context cx = (Context) context.getAscContext();
            validateRequiredSkinPartsAndStates(cx, unit, typeTable);
        }
    }
View Full Code Here

        styleModule.setNameMappings(nameMappings);
        String styleName = generateStyleName(source);
        styleModule.setName(styleName);
        styleModule.extractStyles(styleSheet, false);

        CompilerContext context = new CompilerContext();

        CompilationUnit cssCompilationUnit = source.newCompilationUnit(null, context);

        VirtualFile generatedFile = generateSourceCodeFile(cssCompilationUnit, styleModule);

        Source generatedSource = new Source(generatedFile, source);

        // when building a SWC, we want to locate all the asset sources and ask compc to put them in the SWC.
        Collection<AtEmbed> atEmbeds = styleModule.getAtEmbeds();
        if (atEmbeds != null && configuration.archiveClassesAndAssets())
        {
          Map<String, LocalFile> archiveFiles = new HashMap<String, LocalFile>();
          for (Iterator<AtEmbed>  i = atEmbeds.iterator(); i.hasNext(); )
          {
            AtEmbed e = (AtEmbed) i.next();
            String src = (String) e.getAttributes().get(Transcoder.SOURCE);
            String original = (String) e.getAttributes().get(Transcoder.ORIGINAL);
            if (src != null)
            {
              archiveFiles.put(original, new LocalFile(new File(src)));
            }
          }
          if (archiveFiles.size() > 0)
          {
            context.setAttribute(CompilerContext.CSS_ARCHIVE_FILES, archiveFiles);
          }
        }
       
        // Use MxmlLogAdapter to do filtering, e.g. -generated.as -> .css, as line -> css
        // line, etc...
        Logger original = ThreadLocalToolkit.getLogger();
        LineNumberMap lineNumberMap = styleModule.getLineNumberMap();
        Logger adapter = new MxmlLogAdapter(original, lineNumberMap);
        ThreadLocalToolkit.setLogger(adapter);

        CompilationUnit ascCompilationUnit = delegateSubCompiler.parse1(generatedSource, symbolTable);

        if (ascCompilationUnit != null)
        {
            // transfer includes from the ASC unit to the CSS unit
            cssCompilationUnit.getSource().addFileIncludes(ascCompilationUnit.getSource());
            context.setAttribute(DELEGATE_UNIT, ascCompilationUnit);
            context.setAttribute(LINE_NUMBER_MAP, lineNumberMap);
            Source.transferMetaData(ascCompilationUnit, cssCompilationUnit);
            Source.transferGeneratedSources(ascCompilationUnit, cssCompilationUnit);
            Source.transferDefinitions(ascCompilationUnit, cssCompilationUnit);
            Source.transferInheritance(ascCompilationUnit, cssCompilationUnit);
        }
View Full Code Here

            return unit;
        }

    String path = source.getName();
    ProgramNode node = null;
        CompilerContext context = null;
        Context cx;

        if ((unit != null) && (unit.getSyntaxTree() != null))
        {
            node = (ProgramNode) unit.getSyntaxTree();
            cx = node.cx;
        }
        else
        {
            context = new CompilerContext();
            cx = new Context(symbolTable.perCompileData);
            cx.setScriptName(source.getName());
            cx.setPath(source.getParent());

            cx.setEmitter(symbolTable.emitter);
            cx.setHandler(new CompilerHandler(source));
            symbolTable.perCompileData.handler = cx.getHandler();

            context.setAscContext(cx);

            // conditional compilation: add config settings from the compiler configuration
            // this must be done BEFORE parsing
            final ObjectList<ConfigVar> arr = as3Configuration.getDefine();
            if (arr != null)
View Full Code Here

TOP

Related Classes of flex2.compiler.CompilerContext

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.