当前位置: 首页>>代码示例>>Java>>正文


Java TryNode类代码示例

本文整理汇总了Java中jdk.nashorn.internal.ir.TryNode的典型用法代码示例。如果您正苦于以下问题:Java TryNode类的具体用法?Java TryNode怎么用?Java TryNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TryNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了TryNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enterTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:PrintVisitor.java

示例2: catchAllBlock

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
private Block catchAllBlock(final TryNode tryNode) {
    final int  lineNumber = tryNode.getLineNumber();
    final long token      = tryNode.getToken();
    final int  finish     = tryNode.getFinish();

    final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName(CompilerConstants.EXCEPTION_PREFIX.symbolName()));

    final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), true));
    assert catchBody.isTerminal(); //ends with throw, so terminal

    final CatchNode catchAllNode  = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, true);
    final Block     catchAllBlock = new Block(token, finish, catchAllNode);

    //catchallblock -> catchallnode (catchnode) -> exception -> throw

    return (Block)catchAllBlock.accept(this); //not accepted. has to be accepted by lower
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Lower.java

示例3: enterTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:IRTranslator.java

示例4: enterTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:PrintVisitor.java

示例5: enterTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:IRTranslator.java

示例6: enterTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:23,代码来源:PrintVisitor.java

示例7: catchAllBlock

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
private Block catchAllBlock(final TryNode tryNode) {
    final int  lineNumber = tryNode.getLineNumber();
    final long token      = tryNode.getToken();
    final int  finish     = tryNode.getFinish();

    final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName("catch_all"));

    final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW));
    assert catchBody.isTerminal(); //ends with throw, so terminal

    final CatchNode catchAllNode  = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, CatchNode.IS_SYNTHETIC_RETHROW);
    final Block     catchAllBlock = new Block(token, finish, catchAllNode);

    //catchallblock -> catchallnode (catchnode) -> exception -> throw

    return (Block)catchAllBlock.accept(this); //not accepted. has to be accepted by lower
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:18,代码来源:Lower.java

示例8: beforeTry

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
void beforeTry(final TryNode tryNode, final Label recovery) {
    LocalVariableConversion next = tryNode.getLocalVariableConversion();
    while(next != null) {
        if(next.isLive()) {
            final Type to = emitLocalVariableConversion(next, false);
            recovery.getStack().onLocalStore(to, next.getSymbol().getSlot(to), true);
        }
        next = next.getNext();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:MethodEmitter.java

示例9: leaveTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
@Override
public Node leaveTryNode(final TryNode tryNode) {
    tryNode.setException(exceptionSymbol());
    if (tryNode.getFinallyBody() != null) {
        tryNode.setFinallyCatchAll(exceptionSymbol());
    }

    end(tryNode);

    return tryNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:AssignSymbols.java

示例10: ensureUnconditionalCatch

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Lower.java

示例11: TryTreeImpl

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
TryTreeImpl(final TryNode node,
        final BlockTree block,
        final List<? extends CatchTree> catches,
        final BlockTree finallyBlock) {
    super(node);
    this.block = block;
    this.catches = catches;
    this.finallyBlock = finallyBlock;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:TryTreeImpl.java

示例12: leaveTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
@Override
public Node leaveTryNode(final TryNode tryNode) {
    assert tryNode.getFinallyBody() == null;

    end(tryNode);

    return tryNode.setException(lc, exceptionSymbol());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:AssignSymbols.java

示例13: ensureUnconditionalCatch

import jdk.nashorn.internal.ir.TryNode; //导入依赖的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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:Lower.java

示例14: leaveTryNode

import jdk.nashorn.internal.ir.TryNode; //导入依赖的package包/类
@Override
public Node leaveTryNode(final TryNode tryNode) {
    tryNode.setException(exceptionSymbol());
    assert tryNode.getFinallyBody() == null;

    end(tryNode);

    return tryNode;
}
 
开发者ID:malaporte,项目名称:kaziranga,代码行数:10,代码来源:AssignSymbols.java


注:本文中的jdk.nashorn.internal.ir.TryNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。