Package macromedia.asc.util

Examples of macromedia.asc.util.Context


        // 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

    ContextStatics.useVerboseErrors = false;
   
    qNameTable = new QNameMap<Source>(300);
    multiNames = new HashMap<MultiName, QName>(1024);
    Context cx = new Context(perCompileData);
    emitter = new BytecodeEmitter(cx, null, false, false);
    cx.setEmitter(emitter);
    typeAnalyzer = new TypeAnalyzer(this);
   
    rbNames = new HashMap<String, QName[]>();
    rbNameTable = new HashMap<String, Source>();
  }
View Full Code Here

        return ascContext;
    }

    public Context removeAscContext()
    {
        Context result = ascContext;
        ascContext = null;
        return result;
    }
View Full Code Here

    // "({x:3})" is considered to be an inline object with field "x" that
    // has value 3.
    s = "(" + s + ")"; //$NON-NLS-1$ //$NON-NLS-2$

    ContextStatics statics = new ContextStatics();
    Context cx = new Context(statics);
    final List<ErrorInfo> errors = new ArrayList<ErrorInfo>();
    CompilerHandler newHandler = new CompilerHandler() {
      public void error(final String filename, int ln, int col, String msg, String source) {
        ErrorInfo ei = new ErrorInfo();
        ei.filename = filename;
        ei.ln = ln;
        ei.col = col;
        ei.msg = msg;
        ei.source = source;
        errors.add(ei);
      }
    };
    cx.setHandler(newHandler);
    cx.scriptAssistParsing = true;
    Parser parser = new Parser(cx, s, "Expression"); //$NON-NLS-1$
    ProgramNode programNode = parser.parseProgram();

    if (errors.size() > 0) {
View Full Code Here

        // 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)
        {
            return;
        }

        String className = NameFormatter.toDot(unit.topLevelDefinitions.first());
        boolean exclude = false;
        if (includeOnly != null && !includeOnly.contains(className))
        {
            exclude = true;
        }
        else if (excludeClasses.contains(className))
        {
            excludeClasses.remove(className);
            exclude = true;
        }
        // check the metadata for ExcludeClass. Like Flex Builder, ASDoc uses
        // this compiler metadata to
        // determine which classes should not be visible to the user
        else if (unit.metadata != null)
        {

            for (Iterator iterator = unit.metadata.iterator(); iterator.hasNext();)
            {
                MetaDataNode metaDataNode = (MetaDataNode)iterator.next();
                if (EXCLUDE_CLASS.equals(metaDataNode.getId()))
                {
                    exclude = true;
                    break;
                }
            }
        }

        // the inheritance needs to be processed in a predictable order..
        Set<QName> inheritance = new TreeSet<QName>(new ComparatorImpl());
       
        for (Name name : unit.inheritance)
        {
            if (name instanceof QName)
            {
                inheritance.add((QName) name);
            }
        }

        boolean flag = false;
        if (!exclude && !unit.getSource().isInternal())
        {
            if (Trace.asdoc)
                System.out.println("Generating XML for " + unit.getSource().getName());

            flag = false;
        }
        else
        {
            if (Trace.asdoc)
                System.out.println("Skipping generating XML for " + unit.getSource().getName());

            flag = true;
        }
       
        if (packages.size() != 0)
        {
            String n = unit.topLevelDefinitions.first().getNamespace();
            if (n != null)
            {
                packages.remove(n);
            }
        }

        cx.pushScope(node.frame);

        MetaDataEvaluator printer = new MetaDataEvaluator();
        node.evaluate(cx, printer);

        ObjectList comments = printer.doccomments;

        AbcClass abcClass = typeTable.getClass(unit.topLevelDefinitions.first().toString());
        tab.addComments(unit.topLevelDefinitions.first(), comments, inheritance, flag, cx, abcClass);

        cx.popScope();       
    }
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

        String fileName = className.replace('.', File.separatorChar) + DOT_AS;
        VirtualFile emptyFile = new TextFile(EMPTY_STRING, fileName, null, MimeMappings.AS,
                                             compilationUnit.getSource().getLastModified());
        Source result = new Source(emptyFile, EMPTY_STRING, shortName, null, false, false, false);

        Context cx = AbstractSyntaxTreeUtil.generateContext(symbolTable.perCompileData, result,
                                                            symbolTable.emitter, defines);
        NodeFactory nodeFactory = cx.getNodeFactory();

        HashSet<String> configNamespaces = new HashSet<String>();
        StatementListNode configVars = AbstractSyntaxTreeUtil.parseConfigVars(cx, configNamespaces);
        ProgramNode program = AbstractSyntaxTreeUtil.generateProgram(cx, configVars, EMPTY_STRING);
        StatementListNode programStatementList = program.statements;
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);

            if (node instanceof FunctionDefinitionNode)
            {
                FunctionDefinitionNode function = (FunctionDefinitionNode) node;

                if (function.fexpr != null && function.fexpr.body != null &&
                    function.fexpr.body.items != null)
                {
                    // C: assume that the last node is always the synthetic ReturnStatementNode.
                    NodeFactory nodeFactory = cx.getNodeFactory();
                    function.fexpr.body = nodeFactory.statementList(null, function.fexpr.body.items.removeLast());

                    if (function.fexpr.signature != null && function.fexpr.signature.result != null)
                    {
                        function.fexpr.body.items.add(0, nodeFactory.list(null, nodeFactory.returnStatement(nodeFactory.literalNull())));
View Full Code Here

    public static void ensureMetaDataHasDefinition(CompilationUnit compilationUnit)
    {
        ProgramNode programNode = (ProgramNode) compilationUnit.getSyntaxTree();
        CompilerContext context = compilationUnit.getContext();
        Context cx = context.getAscContext();
        MetaDataEvaluator metaDataEvaluator = new MetaDataEvaluator();
        programNode.evaluate(cx, metaDataEvaluator);
    }
View Full Code Here

TOP

Related Classes of macromedia.asc.util.Context

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.