Java 类jdk.nashorn.internal.ir.ThrowNode 实例源码

项目:OpenJSharp    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:OpenJSharp    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:OpenJSharp    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    throwNode.getExpression().accept(this);
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:openjdk-jdk10    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:openjdk-jdk10    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:openjdk-jdk10    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    visitExpressionOnEmptyStack(throwNode.getExpression());
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:openjdk9    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:openjdk9    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:openjdk9    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    visitExpressionOnEmptyStack(throwNode.getExpression());
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:kaziranga    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:kaziranga    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:kaziranga    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    visitExpressionOnEmptyStack(throwNode.getExpression());
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:lookaside_java-1.8.0-openjdk    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:lookaside_java-1.8.0-openjdk    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    visitExpressionOnEmptyStack(throwNode.getExpression());
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:jdk8u_nashorn    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:jdk8u_nashorn    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:jdk8u_nashorn    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    visitExpressionOnEmptyStack(throwNode.getExpression());
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:infobip-open-jdk-8    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, false));
}
项目:infobip-open-jdk-8    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:infobip-open-jdk-8    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!reachable) {
        return false;
    }

    throwNode.getExpression().accept(this);
    jumpToCatchBlock(throwNode);
    doesNotContinueSequentially();
    return false;
}
项目:OLD-OpenJDK8    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, 0));
}
项目:OLD-OpenJDK8    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:OLD-OpenJDK8    文件:CodeGenerator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    lineNumber(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        //do not wrap whatever this is in an ecma exception, just rethrow it
        load(throwNode.getExpression());
        method.athrow();
        return false;
    }

    method._new(ECMAException.class).dup();

    final Source source     = lc.getCurrentFunction().getSource();

    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    load(expression, Type.OBJECT);

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.THROW_INIT);

    method.athrow();

    return false;
}
项目:nashorn-backport    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, 0));
}
项目:nashorn-backport    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:nashorn-backport    文件:CodeGenerator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    lineNumber(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        //do not wrap whatever this is in an ecma exception, just rethrow it
        load(throwNode.getExpression());
        method.athrow();
        return false;
    }

    method._new(ECMAException.class).dup();

    final Source source     = lc.getCurrentFunction().getSource();

    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    load(expression);
    assert expression.getType().isObject();

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.THROW_INIT);

    method.athrow();

    return false;
}
项目:nashorn    文件:Parser.java   
/**
 * ThrowStatement :
 *      throw Expression ; // [no LineTerminator here]
 *
 * See 12.13
 *
 * Parse throw statement.
 */
private void throwStatement() {
    // Capture THROW token.
    final int  throwLine  = line;
    final long throwToken = token;
    // THROW tested in caller.
    nextOrEOL();

    Expression expression = null;

    // SEMICOLON or expression.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
        break;

    default:
        expression = expression();
        break;
    }

    if (expression == null) {
        throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
    }

    endOfLine();

    appendStatement(new ThrowNode(throwLine, throwToken, finish, expression, 0));
}
项目:nashorn    文件:JSONWriter.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    enterDefault(throwNode);

    type("ThrowStatement");
    comma();

    property("argument");
    throwNode.getExpression().accept(this);

    return leave();
}
项目:nashorn    文件:CodeGenerator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    lineNumber(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        //do not wrap whatever this is in an ecma exception, just rethrow it
        load(throwNode.getExpression());
        method.athrow();
        return false;
    }

    method._new(ECMAException.class).dup();

    final Source source     = lc.getCurrentFunction().getSource();

    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    load(expression);
    assert expression.getType().isObject();

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.THROW_INIT);

    method.athrow();

    return false;
}
项目:OpenJSharp    文件:PrintVisitor.java   
@Override
public boolean enterThrowNode(final ThrowNode node) {
    node.toString(sb, printTypes);
    printLocalVariableConversion(node);
    return false;
}
项目:OpenJSharp    文件:Lower.java   
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
    return addStatement(throwNode); //ThrowNodes are always terminal, marked as such in constructor
}
项目:OpenJSharp    文件:CodeGenerator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        method.beforeJoinPoint(throwNode);

        //do not wrap whatever this is in an ecma exception, just rethrow it
        final IdentNode exceptionExpr = (IdentNode)throwNode.getExpression();
        final Symbol exceptionSymbol = exceptionExpr.getSymbol();
        method.load(exceptionSymbol, EXCEPTION_TYPE);
        method.checkcast(EXCEPTION_TYPE.getTypeClass());
        method.athrow();
        return false;
    }

    final Source     source     = getCurrentSource();
    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    // NOTE: we first evaluate the expression, and only after it was evaluated do we create the new ECMAException
    // object and then somewhat cumbersomely move it beneath the evaluated expression on the stack. The reason for
    // this is that if expression is optimistic (or contains an optimistic subexpression), we'd potentially access
    // the not-yet-<init>ialized object on the stack from the UnwarrantedOptimismException handler, and bytecode
    // verifier forbids that.
    loadExpressionAsObject(expression);

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.CREATE);

    method.beforeJoinPoint(throwNode);
    method.athrow();

    return false;
}
项目:OpenJSharp    文件:WeighNodes.java   
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
    weight += THROW_WEIGHT;
    return throwNode;
}
项目:openjdk-jdk10    文件:IRTranslator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    curStat = new ThrowTreeImpl(throwNode,
            translateExpr(throwNode.getExpression()));
    return false;
}
项目:openjdk-jdk10    文件:ThrowTreeImpl.java   
ThrowTreeImpl(final ThrowNode node, final ExpressionTree expr) {
    super(node);
    this.expr = expr;
}
项目:openjdk-jdk10    文件:PrintVisitor.java   
@Override
public boolean enterThrowNode(final ThrowNode node) {
    node.toString(sb, printTypes);
    printLocalVariableConversion(node);
    return false;
}
项目:openjdk-jdk10    文件:Lower.java   
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
    return addStatement(throwNode); //ThrowNodes are always terminal, marked as such in constructor
}
项目:openjdk-jdk10    文件:CodeGenerator.java   
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        method.beforeJoinPoint(throwNode);

        //do not wrap whatever this is in an ecma exception, just rethrow it
        final IdentNode exceptionExpr = (IdentNode)throwNode.getExpression();
        final Symbol exceptionSymbol = exceptionExpr.getSymbol();
        method.load(exceptionSymbol, EXCEPTION_TYPE);
        method.checkcast(EXCEPTION_TYPE.getTypeClass());
        method.athrow();
        return false;
    }

    final Source     source     = getCurrentSource();
    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    // NOTE: we first evaluate the expression, and only after it was evaluated do we create the new ECMAException
    // object and then somewhat cumbersomely move it beneath the evaluated expression on the stack. The reason for
    // this is that if expression is optimistic (or contains an optimistic subexpression), we'd potentially access
    // the not-yet-<init>ialized object on the stack from the UnwarrantedOptimismException handler, and bytecode
    // verifier forbids that.
    loadExpressionAsObject(expression);

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.CREATE);

    method.beforeJoinPoint(throwNode);
    method.athrow();

    return false;
}
项目:openjdk-jdk10    文件:WeighNodes.java   
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
    weight += THROW_WEIGHT;
    return throwNode;
}