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


Java CatchNode.getException方法代码示例

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


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

示例1: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:AssignSymbols.java

示例2: 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;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:18,代码来源:Attr.java

示例3: 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Lower.java

示例4: 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();
    // 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;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:16,代码来源:SymbolsResolver.java

示例5: 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.getException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。