Java Code Examples for jdk.nashorn.internal.parser.TokenType#AND

The following examples show how to use jdk.nashorn.internal.parser.TokenType#AND . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private boolean enterAND_OR(final BinaryNode binaryNode) {
    final Expression lhs = binaryNode.lhs();
    final Expression rhs = binaryNode.rhs();

    final Label skip = new Label("skip");

    load(lhs, Type.OBJECT).dup().convert(Type.BOOLEAN);

    if (binaryNode.tokenType() == TokenType.AND) {
        method.ifeq(skip);
    } else {
        method.ifne(skip);
    }

    method.pop();
    load(rhs, Type.OBJECT);
    method.label(skip);
    method.store(binaryNode.getSymbol());

    return false;
}
 
Example 2
Source File: CodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean enterAND_OR(final BinaryNode binaryNode) {
    final Expression lhs = binaryNode.lhs();
    final Expression rhs = binaryNode.rhs();

    final Label skip = new Label("skip");

    load(lhs, Type.OBJECT).dup().convert(Type.BOOLEAN);

    if (binaryNode.tokenType() == TokenType.AND) {
        method.ifeq(skip);
    } else {
        method.ifne(skip);
    }

    method.pop();
    load(rhs, Type.OBJECT);
    method.label(skip);
    method.store(binaryNode.getSymbol());

    return false;
}
 
Example 3
Source File: CodeGenerator.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
private boolean enterAND_OR(final BinaryNode binaryNode) {
    final Expression lhs = binaryNode.lhs();
    final Expression rhs = binaryNode.rhs();

    final Label skip = new Label("skip");

    load(lhs).convert(Type.OBJECT).dup().convert(Type.BOOLEAN);

    if (binaryNode.tokenType() == TokenType.AND) {
        method.ifeq(skip);
    } else {
        method.ifne(skip);
    }

    method.pop();
    load(rhs).convert(Type.OBJECT);
    method.label(skip);
    method.store(binaryNode.getSymbol());

    return false;
}