Java Code Examples for jdk.nashorn.internal.ir.TryNode#getCatches()

The following examples show how to use jdk.nashorn.internal.ir.TryNode#getCatches() . 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: IRTranslator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: Lower.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: Lower.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: Lower.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: Lower.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: Lower.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: Lower.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: Lower.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
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);
}