Package org.apache.flex.compiler.tree.as

Examples of org.apache.flex.compiler.tree.as.IConditionalNode


    }

    @Override
    public void emitIf(IIfNode node)
    {
        IConditionalNode conditional = (IConditionalNode) node.getChild(0);

        IContainerNode xnode = (IContainerNode) conditional
                .getStatementContentsNode();

        writeToken(ASEmitterTokens.IF);
        //write(SPACE);
        write(ASEmitterTokens.PAREN_OPEN);
        getWalker().walk(conditional.getChild(0)); // conditional expression
        write(ASEmitterTokens.PAREN_CLOSE);
        if (!isImplicit(xnode))
            write(ASEmitterTokens.SPACE);

        getWalker().walk(conditional.getChild(1)); // BlockNode
        IConditionalNode[] nodes = node.getElseIfNodes();
        if (nodes.length > 0)
        {
            for (int i = 0; i < nodes.length; i++)
            {
                IConditionalNode enode = nodes[i];
                IContainerNode snode = (IContainerNode) enode
                        .getStatementContentsNode();

                final boolean isImplicit = isImplicit(snode);
                if (isImplicit)
                    writeNewline();
                else
                    write(ASEmitterTokens.SPACE);

                writeToken(ASEmitterTokens.ELSE);
                writeToken(ASEmitterTokens.IF);
                write(ASEmitterTokens.PAREN_OPEN);
                getWalker().walk(enode.getChild(0));
                write(ASEmitterTokens.PAREN_CLOSE);
                if (!isImplicit)
                    write(ASEmitterTokens.SPACE);

                getWalker().walk(enode.getChild(1)); // ConditionalNode
            }
        }

        ITerminalNode elseNode = node.getElseNode();
        if (elseNode != null)
View Full Code Here


        IConditionalNode[] cnodes = ASNodeUtils.getCaseNodes(node);
        ITerminalNode dnode = ASNodeUtils.getDefaultNode(node);

        for (int i = 0; i < cnodes.length; i++)
        {
            IConditionalNode casen = cnodes[i];
            IContainerNode cnode = (IContainerNode) casen.getChild(1);
            writeToken(ASEmitterTokens.CASE);
            getWalker().walk(casen.getConditionalExpressionNode());
            write(ASEmitterTokens.COLON);
            if (!isImplicit(cnode))
                write(ASEmitterTokens.SPACE);
            getWalker().walk(casen.getStatementContentsNode());
            if (i == cnodes.length - 1 && dnode == null)
            {
                indentPop();
                writeNewline();
            }
View Full Code Here

    }

    @Override
    public void emitIf(IIfNode node)
    {
        IConditionalNode conditional = (IConditionalNode) node.getChild(0);

        IContainerNode xnode = (IContainerNode) conditional
                .getStatementContentsNode();

        writeToken(ASEmitterTokens.IF);
        //write(SPACE);
        write(ASEmitterTokens.PAREN_OPEN);
        getWalker().walk(conditional.getChild(0)); // conditional expression
        write(ASEmitterTokens.PAREN_CLOSE);
        if (!isImplicit(xnode))
            write(ASEmitterTokens.SPACE);

        getWalker().walk(conditional.getChild(1)); // BlockNode
        IConditionalNode[] nodes = node.getElseIfNodes();
        if (nodes.length > 0)
        {
            for (int i = 0; i < nodes.length; i++)
            {
                IConditionalNode enode = nodes[i];
                IContainerNode snode = (IContainerNode) enode
                        .getStatementContentsNode();

                final boolean isImplicit = isImplicit(snode);
                if (isImplicit)
                    writeNewline();
                else
                    write(ASEmitterTokens.SPACE);

                writeToken(ASEmitterTokens.ELSE);
                writeToken(ASEmitterTokens.IF);
                write(ASEmitterTokens.PAREN_OPEN);
                getWalker().walk(enode.getChild(0));
                write(ASEmitterTokens.PAREN_CLOSE);
                if (!isImplicit)
                    write(ASEmitterTokens.SPACE);

                getWalker().walk(enode.getChild(1)); // ConditionalNode
            }
        }

        ITerminalNode elseNode = node.getElseNode();
        if (elseNode != null)
View Full Code Here

        IConditionalNode[] cnodes = ASNodeUtils.getCaseNodes(node);
        ITerminalNode dnode = ASNodeUtils.getDefaultNode(node);

        for (int i = 0; i < cnodes.length; i++)
        {
            IConditionalNode casen = cnodes[i];
            IContainerNode cnode = (IContainerNode) casen.getChild(1);
            writeToken(ASEmitterTokens.CASE);
            getWalker().walk(casen.getConditionalExpressionNode());
            write(ASEmitterTokens.COLON);
            if (!isImplicit(cnode))
                write(ASEmitterTokens.SPACE);
            getWalker().walk(casen.getStatementContentsNode());
            if (i == cnodes.length - 1 && dnode == null)
            {
                indentPop();
                writeNewline();
            }
View Full Code Here

    }

    @Override
    public void emitIf(IIfNode node)
    {
        IConditionalNode conditional = (IConditionalNode) node.getChild(0);

        IContainerNode xnode = (IContainerNode) conditional
                .getStatementContentsNode();

        write("if");
        write(" ");
        write("(");
        getWalker().walk(conditional.getChild(0)); // conditional expression
        write(")");
        if (!isImplicit(xnode))
            write(" ");

        getWalker().walk(conditional.getChild(1)); // BlockNode
        IConditionalNode[] nodes = node.getElseIfNodes();
        if (nodes.length > 0)
        {
            for (int i = 0; i < nodes.length; i++)
            {
                IConditionalNode enode = nodes[i];
                IContainerNode snode = (IContainerNode) enode
                        .getStatementContentsNode();

                final boolean isImplicit = isImplicit(snode);
                if (isImplicit)
                    write("\n");
                else
                    write(" ");

                write("else if");
                write(" ");
                write("(");
                getWalker().walk(enode.getChild(0));
                write(")");
                if (!isImplicit)
                    write(" ");

                getWalker().walk(enode.getChild(1)); // ConditionalNode
            }
        }

        ITerminalNode elseNode = node.getElseNode();
        if (elseNode != null)
View Full Code Here

        IConditionalNode[] cnodes = getCaseNodes(node);
        ITerminalNode dnode = getDefaultNode(node);

        for (int i = 0; i < cnodes.length; i++)
        {
            IConditionalNode casen = cnodes[i];
            IContainerNode cnode = (IContainerNode) casen.getChild(1);
            write("case");
            write(" ");
            getWalker().walk(casen.getConditionalExpressionNode());
            write(":");
            if (!isImplicit(cnode))
                write(" ");
            getWalker().walk(casen.getStatementContentsNode());
            if (i == cnodes.length - 1 && dnode == null)
            {
                indentPop();
                write("\n");
            }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.as.IConditionalNode

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.