本文整理汇总了Java中jdk.nashorn.internal.ir.ThrowNode.position方法的典型用法代码示例。如果您正苦于以下问题:Java ThrowNode.position方法的具体用法?Java ThrowNode.position怎么用?Java ThrowNode.position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.ThrowNode
的用法示例。
在下文中一共展示了ThrowNode.position方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterThrowNode
import jdk.nashorn.internal.ir.ThrowNode; //导入方法依赖的package包/类
@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;
}
示例2: enterThrowNode
import jdk.nashorn.internal.ir.ThrowNode; //导入方法依赖的package包/类
@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;
}