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


Java CatchNode.getExceptionCondition方法代码示例

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


在下文中一共展示了CatchNode.getExceptionCondition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JSONWriter.java

示例2: leaveCatchNode

import jdk.nashorn.internal.ir.CatchNode; //导入方法依赖的package包/类
@Override
public Node leaveCatchNode(final CatchNode catchNode) {
    final Expression exceptionCondition = catchNode.getExceptionCondition();
    if (exceptionCondition != null) {
        return catchNode.setExceptionCondition(convert(exceptionCondition, Type.BOOLEAN));
    }
    return catchNode;
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:9,代码来源:FinalizeTypes.java

示例3: enterTryNode

import jdk.nashorn.internal.ir.CatchNode; //导入方法依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
    if(!reachable) {
        return false;
    }

    // This is the label for the join point at the entry of the catch blocks.
    final Label catchLabel = new Label("");
    catchLabels.push(catchLabel);

    // Presume that even the start of the try block can immediately go to the catch
    jumpToLabel(tryNode, catchLabel);

    final Block body = tryNode.getBody();
    body.accept(this);
    catchLabels.pop();

    // Final exit label for the whole try/catch construct (after the try block and after all catches).
    final Label endLabel = new Label("");

    boolean canExit = false;
    if(reachable) {
        jumpToLabel(body, endLabel);
        canExit = true;
    }
    doesNotContinueSequentially();

    joinOnLabel(catchLabel);
    for(final CatchNode catchNode: tryNode.getCatches()) {
        final IdentNode exception = catchNode.getException();
        onAssignment(exception, LvarType.OBJECT);
        final Expression condition = catchNode.getExceptionCondition();
        if(condition != null) {
            condition.accept(this);
        }
        final Map<Symbol, LvarType> afterConditionTypes = localVariableTypes;
        final Block catchBody = catchNode.getBody();
        // TODO: currently, we consider that the catch blocks are always reachable from the try block as currently
        // we lack enough analysis to prove that no statement before a break/continue/return in the try block can
        // throw an exception.
        reachable = true;
        catchBody.accept(this);
        final Symbol exceptionSymbol = exception.getSymbol();
        if(reachable) {
            localVariableTypes = cloneMap(localVariableTypes);
            localVariableTypes.remove(exceptionSymbol);
            jumpToLabel(catchBody, endLabel);
            canExit = true;
        }
        localVariableTypes = cloneMap(afterConditionTypes);
        localVariableTypes.remove(exceptionSymbol);
    }
    // NOTE: if we had one or more conditional catch blocks with no unconditional catch block following them, then
    // there will be an unconditional rethrow, so the join point can never be reached from the last
    // conditionExpression.
    doesNotContinueSequentially();

    if(canExit) {
        joinOnLabel(endLabel);
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:LocalVariableTypesCalculator.java


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