本文整理汇总了Java中jdk.nashorn.internal.ir.CatchNode类的典型用法代码示例。如果您正苦于以下问题:Java CatchNode类的具体用法?Java CatchNode怎么用?Java CatchNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CatchNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了CatchNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterCatchNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
enterDefault(catchNode);
type("CatchClause");
comma();
property("param");
catchNode.getException().accept(this);
comma();
final Node guard = catchNode.getExceptionCondition();
if (guard != null) {
property("guard");
guard.accept(this);
comma();
}
property("body");
catchNode.getBody().accept(this);
return leave();
}
示例2: enterTryNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
tryNode.toString(sb, printTypes);
printLocalVariableConversion(tryNode);
tryNode.getBody().accept(this);
final List<Block> catchBlocks = tryNode.getCatchBlocks();
for (final Block catchBlock : catchBlocks) {
final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0);
catchNode.toString(sb, printTypes);
catchNode.getBody().accept(this);
}
final Block finallyBody = tryNode.getFinallyBody();
if (finallyBody != null) {
sb.append(" finally ");
finallyBody.accept(this);
}
return false;
}
示例3: enterCatchNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
final IdentNode exception = catchNode.getException();
final Block block = lc.getCurrentBlock();
start(catchNode);
// define block-local exception variable
final String exname = exception.getName();
// If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
// symbol is naturally internal, and should be treated as such.
final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
// IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
// clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
symbol.clearFlag(IS_LET);
return true;
}
示例4: enterTryNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
final List<? extends CatchNode> catchNodes = tryNode.getCatches();
final List<CatchTreeImpl> catchTrees = new ArrayList<>(catchNodes.size());
for (final CatchNode catchNode : catchNodes) {
catchTrees.add(new CatchTreeImpl(catchNode,
translateExpr(catchNode.getException()),
(BlockTree) translateBlock(catchNode.getBody()),
translateExpr(catchNode.getExceptionCondition())));
}
curStat = new TryTreeImpl(tryNode,
(BlockTree) translateBlock(tryNode.getBody()),
catchTrees,
(BlockTree) translateBlock(tryNode.getFinallyBody()));
return false;
}
示例5: enterTryNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
tryNode.toString(sb, printTypes);
printLocalVariableConversion(tryNode);
tryNode.getBody().accept(this);
final List<Block> catchBlocks = tryNode.getCatchBlocks();
for (final Block catchBlock : catchBlocks) {
final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0);
catchNode.toString(sb, printTypes);
catchNode.getBody().accept(this);
}
final Block finallyBody = tryNode.getFinallyBody();
if (finallyBody != null) {
sb.append(" finally ");
finallyBody.accept(this);
}
for (final Block inlinedFinally : tryNode.getInlinedFinallies()) {
inlinedFinally.accept(this);
}
return false;
}
示例6: enterCatchNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
final IdentNode exception = catchNode.getExceptionIdentifier();
final Block block = lc.getCurrentBlock();
start(catchNode);
// define block-local exception variable
final String exname = exception.getName();
// If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
// symbol is naturally internal, and should be treated as such.
final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
// IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
// clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
symbol.clearFlag(IS_LET);
return true;
}
示例7: enterTryNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
final List<? extends CatchNode> catchNodes = tryNode.getCatches();
final List<CatchTreeImpl> catchTrees = new ArrayList<>(catchNodes.size());
for (final CatchNode catchNode : catchNodes) {
catchTrees.add(new CatchTreeImpl(catchNode,
translateIdent(catchNode.getException()),
(BlockTree) translateBlock(catchNode.getBody()),
translateExpr(catchNode.getExceptionCondition())));
}
curStat = new TryTreeImpl(tryNode,
(BlockTree) translateBlock(tryNode.getBody()),
catchTrees,
(BlockTree) translateBlock(tryNode.getFinallyBody()));
return false;
}
示例8: enterTryNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
tryNode.toString(sb);
tryNode.getBody().accept(this);
final List<Block> catchBlocks = tryNode.getCatchBlocks();
for (final Block catchBlock : catchBlocks) {
final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0);
catchNode.toString(sb);
catchNode.getBody().accept(this);
}
final Block finallyBody = tryNode.getFinallyBody();
if (finallyBody != null) {
sb.append(" finally ");
finallyBody.accept(this);
}
return false;
}
示例9: enterCatchNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
final IdentNode exception = catchNode.getException();
final Block block = lc.getCurrentBlock();
start(catchNode);
catchNestingLevel++;
// define block-local exception variable
final String exname = exception.getName();
final Symbol def = defineSymbol(block, exname, IS_VAR | IS_LET | IS_ALWAYS_DEFINED);
newType(def, Type.OBJECT); //we can catch anything, not just ecma exceptions
addLocalDef(exname);
return true;
}
示例10: ensureUnconditionalCatch
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
private TryNode ensureUnconditionalCatch(final TryNode tryNode) {
final List<CatchNode> catches = tryNode.getCatches();
if(catches == null || catches.isEmpty() || catches.get(catches.size() - 1).getExceptionCondition() == null) {
return tryNode;
}
// If the last catch block is conditional, add an unconditional rethrow block
final List<Block> newCatchBlocks = new ArrayList<>(tryNode.getCatchBlocks());
newCatchBlocks.add(catchAllBlock(tryNode));
return tryNode.setCatchBlocks(newCatchBlocks);
}
示例11: CatchTreeImpl
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
CatchTreeImpl(final CatchNode node,
final ExpressionTree param,
final BlockTree block,
final ExpressionTree condition) {
super(node);
this.param = param;
this.block = block;
this.condition = condition;
}
示例12: enterCatchNode
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
Expression exception = catchNode.getException();
if ((exception != null) && !(exception instanceof IdentNode)) {
throwNotImplementedYet("es6.destructuring", exception);
}
return true;
}
示例13: ensureUnconditionalCatch
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
private TryNode ensureUnconditionalCatch(final TryNode tryNode) {
final List<CatchNode> catches = tryNode.getCatches();
if(catches == null || catches.isEmpty() || catches.get(catches.size() - 1).getExceptionCondition() == null) {
return tryNode;
}
// If the last catch block is conditional, add an unconditional rethrow block
final List<Block> newCatchBlocks = new ArrayList<>(tryNode.getCatchBlocks());
newCatchBlocks.add(catchAllBlock(tryNode));
return tryNode.setCatchBlocks(lc, newCatchBlocks);
}
示例14: CatchTreeImpl
import jdk.nashorn.internal.ir.CatchNode; //导入依赖的package包/类
CatchTreeImpl(final CatchNode node,
final IdentifierTree param,
final BlockTree block,
final ExpressionTree condition) {
super(node);
this.param = param;
this.block = block;
this.condition = condition;
}