Package org.jruby.ast

Examples of org.jruby.ast.AndNode


        context.defineAlias(alias.getNewName(), alias.getOldName());
    }

    public void compileAnd(Node node, BodyCompiler context) {
        final AndNode andNode = (AndNode) node;

        compile(andNode.getFirstNode(), context);

        BranchCallback longCallback = new BranchCallback() {

                    public void branch(BodyCompiler context) {
                        compile(andNode.getSecondNode(), context);
                    }
                };

        context.performLogicalAnd(longCallback);
    }
View Full Code Here


        switch (node.nodeId) {
        case ALIASNODE:
            setFlag(METHOD);
            break;
        case ANDNODE:
            AndNode andNode = (AndNode)node;
            inspect(andNode.getFirstNode());
            inspect(andNode.getSecondNode());
            break;
        case ARGSCATNODE:
            ArgsCatNode argsCatNode = (ArgsCatNode)node;
            inspect(argsCatNode.getFirstNode());
            inspect(argsCatNode.getSecondNode());
View Full Code Here

        }
        case ANDNODE:
            leftNode = cond0(((AndNode) node).getFirstNode());
            rightNode = cond0(((AndNode) node).getSecondNode());
           
            return new AndNode(node.getPosition(), makeNullNil(leftNode), makeNullNil(rightNode));
        case ORNODE:
            leftNode = cond0(((OrNode) node).getFirstNode());
            rightNode = cond0(((OrNode) node).getSecondNode());
           
            return new OrNode(node.getPosition(), makeNullNil(leftNode), makeNullNil(rightNode));
View Full Code Here

    }

    public AndNode newAndNode(ISourcePosition position, Node left, Node right) {
        checkExpression(left);
       
        if (left == null && right == null) return new AndNode(position, makeNullNil(left), makeNullNil(right));
       
        return new AndNode(union(left, right), makeNullNil(left), makeNullNil(right));
    }
View Full Code Here

        switch (node.getNodeType()) {
        case ALIASNODE:
            setFlag(node, METHOD);
            break;
        case ANDNODE:
            AndNode andNode = (AndNode)node;
            inspect(andNode.getFirstNode());
            inspect(andNode.getSecondNode());
            break;
        case ARGSCATNODE:
            ArgsCatNode argsCatNode = (ArgsCatNode)node;
            inspect(argsCatNode.getFirstNode());
            inspect(argsCatNode.getSecondNode());
View Full Code Here

        // TODO: don't require pop
        if (!expr) context.consumeCurrentValue();
    }

    public void compileAnd(Node node, BodyCompiler context, final boolean expr) {
        final AndNode andNode = (AndNode) node;

        if (andNode.getFirstNode().getNodeType().alwaysTrue()) {
            // compile first node as non-expr and then second node
            compile(andNode.getFirstNode(), context, false);
            compile(andNode.getSecondNode(), context, expr);
        } else if (andNode.getFirstNode().getNodeType().alwaysFalse()) {
            // compile first node only
            compile(andNode.getFirstNode(), context, expr);
        } else {
            compile(andNode.getFirstNode(), context, true);
            BranchCallback longCallback = new BranchCallback() {
                        public void branch(BodyCompiler context) {
                            compile(andNode.getSecondNode(), context, true);
                        }
                    };

            context.performLogicalAnd(longCallback);
            if (!expr) context.consumeCurrentValue();
View Full Code Here

        }
        case ANDNODE:
            leftNode = cond0(((AndNode) node).getFirstNode());
            rightNode = cond0(((AndNode) node).getSecondNode());
           
            return new AndNode(node.getPosition(), makeNullNil(leftNode), makeNullNil(rightNode));
        case ORNODE:
            leftNode = cond0(((OrNode) node).getFirstNode());
            rightNode = cond0(((OrNode) node).getSecondNode());
           
            return new OrNode(node.getPosition(), makeNullNil(leftNode), makeNullNil(rightNode));
View Full Code Here

    }

    public AndNode newAndNode(ISourcePosition position, Node left, Node right) {
        checkExpression(left);
       
        if (left == null && right == null) return new AndNode(position, makeNullNil(left), makeNullNil(right));
       
        return new AndNode(position(left, right), makeNullNil(left), makeNullNil(right));
    }
View Full Code Here

TOP

Related Classes of org.jruby.ast.AndNode

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.