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


Java CatchNode类代码示例

本文整理汇总了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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JSONWriter.java

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

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

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

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

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

示例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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:IRTranslator.java

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

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

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

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

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

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

示例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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:10,代码来源:CatchTreeImpl.java


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