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


Java BreakableNode类代码示例

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


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

示例1: getBreakTargetTypes

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
private Map<Symbol, LvarType> getBreakTargetTypes(final BreakableNode target) {
    // Remove symbols defined in the the blocks that are being broken out of.
    Map<Symbol, LvarType> types = localVariableTypes;
    for(final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
        final LexicalContextNode node = it.next();
        if(node instanceof Block) {
            for(final Symbol symbol: ((Block)node).getSymbols()) {
                if(localVariableTypes.containsKey(symbol)) {
                    if(types == localVariableTypes) {
                        types = cloneMap(localVariableTypes);
                    }
                    types.remove(symbol);
                }
            }
        }
        if(node == target) {
            break;
        }
    }
    return types;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:LocalVariableTypesCalculator.java

示例2: enterJumpStatement

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    final BreakableNode target = jump.getTarget(lc);
    jumpToLabel(jump, jump.getTargetLabel(target), getBreakTargetTypes(target));
    doesNotContinueSequentially();
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:LocalVariableTypesCalculator.java

示例3: enterJumpStatement

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    final BreakableNode target = jump.getTarget(lc);
    popScopesUntil(target);
    final Label targetLabel = jump.getTargetLabel(target);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

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

示例4: enterBreakNode

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    lineNumber(breakNode);

    final BreakableNode breakFrom = lc.getBreakable(breakNode.getLabel());
    for (int i = 0; i < lc.getScopeNestingLevelTo(breakFrom); i++) {
        closeWith();
    }
    method.splitAwareGoto(lc, breakFrom.getBreakLabel());

    return false;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:13,代码来源:CodeGenerator.java

示例5: breakStatement

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
/**
 * BreakStatement :
 *      break Identifier? ; // [no LineTerminator here]
 *
 * See 12.8
 *
 */
private void breakStatement() {
    // Capture BREAK token.
    final int  breakLine  = line;
    final long breakToken = token;
    // BREAK tested in caller.
    nextOrEOL();

    LabelNode labelNode = null;

    // SEMICOLON or label.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
    case EOF:
        break;

    default:
        final IdentNode ident = getIdent();
        labelNode = lc.findLabel(ident.getName());

        if (labelNode == null) {
            throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
        }

        break;
    }

    //either an explicit label - then get its node or just a "break" - get first breakable
    //targetNode is what we are breaking out from.
    final String labelName = labelNode == null ? null : labelNode.getLabelName();
    final BreakableNode targetNode = lc.getBreakable(labelName);
    if (targetNode == null) {
        throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
    }

    endOfLine();

    // Construct and add BREAK node.
    appendStatement(new BreakNode(breakLine, breakToken, finish, labelName));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:Parser.java

示例6: breakStatement

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
/**
 * BreakStatement :
 *      break Identifier? ; // [no LineTerminator here]
 *
 * See 12.8
 *
 */
private void breakStatement() {
    // Capture BREAK token.
    final int  breakLine  = line;
    final long breakToken = token;
    // BREAK tested in caller.
    nextOrEOL();

    LabelNode labelNode = null;

    // SEMICOLON or label.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
    case EOF:
        break;

    default:
        final IdentNode ident = getIdent();
        labelNode = lc.findLabel(ident.getName());

        if (labelNode == null) {
            throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
        }

        break;
    }

    //either an explicit label - then get its node or just a "break" - get first breakable
    //targetNode is what we are breaking out from.
    final IdentNode label = labelNode == null ? null : labelNode.getLabel();
    final BreakableNode targetNode = lc.getBreakable(label);
    if (targetNode == null) {
        throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
    }

    endOfLine();

    // Construct and add BREAK node.
    appendStatement(new BreakNode(breakLine, breakToken, finish, label == null ? null : new IdentNode(label)));
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:49,代码来源:Parser.java

示例7: leaveBreakable

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
/**
 * Leave a breakable node. If there's a join point associated with its break label (meaning there was at least one
 * break statement to the end of the node), insert the join point into the flow.
 * @param breakable the breakable node being left.
 */
private void leaveBreakable(final BreakableNode breakable) {
    joinOnLabel(breakable.getBreakLabel());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:LocalVariableTypesCalculator.java

示例8: leaveBreakable

import jdk.nashorn.internal.ir.BreakableNode; //导入依赖的package包/类
/**
 * Leave a breakable node. If there's a join point associated with its break label (meaning there was at least one
 * break statement to the end of the node), insert the join point into the flow.
 * @param breakable the breakable node being left.
 */
private void leaveBreakable(final BreakableNode breakable) {
    joinOnLabel(breakable.getBreakLabel());
    assertTypeStackIsEmpty();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:LocalVariableTypesCalculator.java


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