Package flex2.compiler

Examples of flex2.compiler.CompilerContext


    if (node.state != ProgramNode.Inheritance)
    {
      return;
    }

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

    ObjectValue global = new ObjectValue(cx, new GlobalBuilder(), null);
    cx.pushScope(global); // first scope is always considered the global scope.

    // run FlowAnalyzer
    FlowGraphEmitter flowem = new FlowGraphEmitter(cx, unit.getSource().getName(), false);
    FlowAnalyzer flower = new FlowAnalyzer(flowem);
    context.setAttribute("FlowAnalyzer", flower);

    // 1. ProgramNode.state == Inheritance
    node.evaluate(cx, flower);
    cx.popScope();
View Full Code Here


    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

    if (node.state == ProgramNode.Inheritance || node.state == ProgramNode.Else)
    {
      return;
    }

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

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

    // C: If --coach is turned on, do inheritSlots for unit.expressions here...
        if (as3Configuration.strict() || as3Configuration.warnings())
        {
        inheritSlots(unit, unit.expressions, symbolTable);
        }

    if (as3Configuration.strict())
    {
      verifyImportPackages(unit.importPackageStatements, context);
      verifyImportDefinitions(unit.importDefinitionStatements, context);
    }

    if (true /*configuration.metadataExport()*/ && ! unit.getSource().isInternal())
        {
            cx.pushScope(node.frame);
          // C: for SWC generation, use debug(). this makes MetaDataEvaluator generate go-to-definition metadata.
          //    it's okay because compc doesn't use PostLink
          //    for debug-mode movies, MetaDataEvaluator will generate go-to-definition metadata.
          //    But PostLink will take them out.
            macromedia.asc.parser.MetaDataEvaluator printer =
                new macromedia.asc.parser.MetaDataEvaluator(as3Configuration.debug(), !as3Configuration.optimize());
            node.evaluate(cx,printer);

          if (as3Configuration.doc() && unit.getSource().isDebuggable())
          {
            StringBuilder out = new StringBuilder();
            out.append("<asdoc>").append("\n");

            ObjectList comments = printer.doccomments;
            int numComments = comments.size();
            for(int x = 0; x < numComments; x++)
            {
              ((DocCommentNode) comments.get(x)).emit(cx,out);
            }
            out.append("\n").append("</asdoc>").append("\n");
          }

          cx.popScope();
        }

        if (ThreadLocalToolkit.errorCount() > 0)
        {
            return;
        }

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

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

        if (node.state == ProgramNode.Inheritance || node.state == ProgramNode.Else)
        {
            return;
        }

        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

            return;
        }

    TypeTable typeTable = (TypeTable) symbolTable.getContext().getAttribute(AttrTypeTable);

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

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

    LineNumberMap map = (LineNumberMap) context.getAttribute("LineNumberMap");

    Emitter emitter = new BytecodeEmitter(cx, unit.getSource(),
                                              as3Configuration.debug() || as3Configuration.verboseStacktraces(),
                                              !as3Configuration.optimize(),
                                              as3Configuration.keepEmbedMetadata(),
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

    {
        // this code is similar to code in asc. We don't go through the main asc
        // path, though,
        // and have multiple compilation passes, so we have to have our own
        // version of this code
        CompilerContext flexCx = unit.getContext();
        // Don't do the HashMap lookup for the context. access strongly typed
        // variable for the ASC Context from CompilerContext
        Context cx = flexCx.getAscContext();
        ProgramNode node = (ProgramNode)unit.getSyntaxTree();

        // stop processing if unit.topLevelDefinitions.first() is null
        if (unit.topLevelDefinitions.first() == null)
        {
View Full Code Here

    {
    }

    public void generate(CompilationUnit compilationUnit, TypeTable typeTable)
    {
        CompilerContext context = compilationUnit.getContext();
        Context cx = context.getAscContext();
        Node node = (Node) compilationUnit.getSyntaxTree();
        DataBindingFirstPassEvaluator dataBindingFirstPassEvaluator =
            new DataBindingFirstPassEvaluator(compilationUnit, typeTable, showBindingWarnings);

        node.evaluate(cx, dataBindingFirstPassEvaluator);
View Full Code Here

        program.statements = programStatementList;

        PackageDefinitionNode packageDefinition = nodeFactory.finishPackage(cx, null);
        nodeFactory.statementList(programStatementList, packageDefinition);

    CompilerContext context = new CompilerContext();
    context.setAscContext(cx);
    result.newCompilationUnit(program, context).setSyntaxTree(program);

        // Useful when comparing abstract syntax trees
        //flash.swf.tools.SyntaxTreeDumper.dump(program, "/tmp/" + className + "New.xml");
View Full Code Here

        }

        ClassDefinitionNode clsdef = getFirstClassDefinition((ProgramNode) ascUnit.getSyntaxTree());
        assert clsdef != null : "could not find a class definition node...";

        CompilerContext context = ascUnit.getContext();
        Context cx = context.getAscContext();

        for (int i = 0, size = (clsdef != null && clsdef.statements != null && clsdef.statements.items != null) ? clsdef.statements.items.size() : 0; i < size; i++)
        {
            Object node = clsdef.statements.items.get(i);
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.