jdk.nashorn.internal.ir.IndexNode Java Examples

The following examples show how to use jdk.nashorn.internal.ir.IndexNode. 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: JSONWriter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #2
Source File: JSONWriter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #3
Source File: JSONWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #4
Source File: JSONWriter.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #5
Source File: JSONWriter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #6
Source File: JSONWriter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #7
Source File: JSONWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #8
Source File: JSONWriter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #9
Source File: JSONWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #10
Source File: JSONWriter.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    enterDefault(indexNode);

    type("MemberExpression");
    comma();

    property("object");
    indexNode.getBase().accept(this);
    comma();

    property("property");
    indexNode.getIndex().accept(this);
    comma();

    property("computed", true);

    return leave();
}
 
Example #11
Source File: Lower.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #12
Source File: Lower.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #13
Source File: Parser.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify an assignment expression.
 * @param op  Operation token.
 * @param lhs Left hand side expression.
 * @param rhs Right hand side expression.
 * @return Verified expression.
 */
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
    final TokenType opType = Token.descType(op);

    switch (opType) {
    case ASSIGN:
    case ASSIGN_ADD:
    case ASSIGN_BIT_AND:
    case ASSIGN_BIT_OR:
    case ASSIGN_BIT_XOR:
    case ASSIGN_DIV:
    case ASSIGN_MOD:
    case ASSIGN_MUL:
    case ASSIGN_SAR:
    case ASSIGN_SHL:
    case ASSIGN_SHR:
    case ASSIGN_SUB:
        if (!(lhs instanceof AccessNode ||
              lhs instanceof IndexNode ||
              lhs instanceof IdentNode)) {
            return referenceError(lhs, rhs, env._early_lvalue_error);
        }

        if (lhs instanceof IdentNode) {
            if (!checkIdentLValue((IdentNode)lhs)) {
                return referenceError(lhs, rhs, false);
            }
            verifyStrictIdent((IdentNode)lhs, "assignment");
        }
        break;

    default:
        break;
    }

    // Build up node.
    return new BinaryNode(op, lhs, rhs);
}
 
Example #14
Source File: Lower.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #15
Source File: Lower.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #16
Source File: Lower.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #17
Source File: Parser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify an assignment expression.
 * @param op  Operation token.
 * @param lhs Left hand side expression.
 * @param rhs Right hand side expression.
 * @return Verified expression.
 */
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
    final TokenType opType = Token.descType(op);

    switch (opType) {
    case ASSIGN:
    case ASSIGN_ADD:
    case ASSIGN_BIT_AND:
    case ASSIGN_BIT_OR:
    case ASSIGN_BIT_XOR:
    case ASSIGN_DIV:
    case ASSIGN_MOD:
    case ASSIGN_MUL:
    case ASSIGN_SAR:
    case ASSIGN_SHL:
    case ASSIGN_SHR:
    case ASSIGN_SUB:
        if (!(lhs instanceof AccessNode ||
              lhs instanceof IndexNode ||
              lhs instanceof IdentNode)) {
            return referenceError(lhs, rhs, env._early_lvalue_error);
        }

        if (lhs instanceof IdentNode) {
            if (!checkIdentLValue((IdentNode)lhs)) {
                return referenceError(lhs, rhs, false);
            }
            verifyStrictIdent((IdentNode)lhs, "assignment");
        }
        break;

    default:
        break;
    }

    // Build up node.
    return new BinaryNode(op, lhs, rhs);
}
 
Example #18
Source File: IRTranslator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    curExpr = new ArrayAccessTreeImpl(indexNode,
            translateExpr(indexNode.getBase()),
            translateExpr(indexNode.getIndex()));
    return false;
}
 
Example #19
Source File: Parser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify an assignment expression.
 * @param op  Operation token.
 * @param lhs Left hand side expression.
 * @param rhs Right hand side expression.
 * @return Verified expression.
 */
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
    final TokenType opType = Token.descType(op);

    switch (opType) {
    case ASSIGN:
    case ASSIGN_ADD:
    case ASSIGN_BIT_AND:
    case ASSIGN_BIT_OR:
    case ASSIGN_BIT_XOR:
    case ASSIGN_DIV:
    case ASSIGN_MOD:
    case ASSIGN_MUL:
    case ASSIGN_SAR:
    case ASSIGN_SHL:
    case ASSIGN_SHR:
    case ASSIGN_SUB:
        if (!(lhs instanceof AccessNode ||
              lhs instanceof IndexNode ||
              lhs instanceof IdentNode)) {
            return referenceError(lhs, rhs, env._early_lvalue_error);
        }

        if (lhs instanceof IdentNode) {
            if (!checkIdentLValue((IdentNode)lhs)) {
                return referenceError(lhs, rhs, false);
            }
            verifyStrictIdent((IdentNode)lhs, "assignment");
        }
        break;

    default:
        break;
    }

    // Build up node.
    return new BinaryNode(op, lhs, rhs);
}
 
Example #20
Source File: Lower.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    final String name = getConstantPropertyName(indexNode.getIndex());
    if (name != null) {
        // If index node is a constant property name convert index node to access node.
        assert indexNode.isIndex();
        return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
    }
    return super.leaveIndexNode(indexNode);
}
 
Example #21
Source File: WeighNodes.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    weight += ACCESS_WEIGHT;
    return indexNode;
}
 
Example #22
Source File: OptimisticTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    tagNeverOptimistic(indexNode.getBase());
    return true;
}
 
Example #23
Source File: ProgramPoints.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    return setProgramPoint(indexNode);
}
 
Example #24
Source File: LocalVariableTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    visitExpression(indexNode.getBase());
    visitExpression(indexNode.getIndex());
    return pushExpressionType(indexNode);
}
 
Example #25
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    visitExpression(indexNode.getBase());
    visitExpression(indexNode.getIndex());
    return pushExpressionType(indexNode);
}
 
Example #26
Source File: CodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    load(indexNode);
    return false;
}
 
Example #27
Source File: OptimisticTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
    tagNeverOptimistic(indexNode.getBase());
    return true;
}
 
Example #28
Source File: Parser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Verify an assignment expression.
 * @param op  Operation token.
 * @param lhs Left hand side expression.
 * @param rhs Right hand side expression.
 * @return Verified expression.
 */
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
    final TokenType opType = Token.descType(op);

    switch (opType) {
    case ASSIGN:
    case ASSIGN_ADD:
    case ASSIGN_BIT_AND:
    case ASSIGN_BIT_OR:
    case ASSIGN_BIT_XOR:
    case ASSIGN_DIV:
    case ASSIGN_MOD:
    case ASSIGN_MUL:
    case ASSIGN_SAR:
    case ASSIGN_SHL:
    case ASSIGN_SHR:
    case ASSIGN_SUB:
        if (!(lhs instanceof AccessNode ||
              lhs instanceof IndexNode ||
              lhs instanceof IdentNode)) {
            return referenceError(lhs, rhs, env._early_lvalue_error);
        }

        if (lhs instanceof IdentNode) {
            if (!checkIdentLValue((IdentNode)lhs)) {
                return referenceError(lhs, rhs, false);
            }
            verifyStrictIdent((IdentNode)lhs, "assignment");
        }
        break;

    default:
        break;
    }

    // Build up node.
    if(BinaryNode.isLogical(opType)) {
        return new BinaryNode(op, new JoinPredecessorExpression(lhs), new JoinPredecessorExpression(rhs));
    }
    return new BinaryNode(op, lhs, rhs);
}
 
Example #29
Source File: WeighNodes.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    weight += ACCESS_WEIGHT;
    return indexNode;
}
 
Example #30
Source File: ProgramPoints.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
    return setProgramPoint(indexNode);
}