本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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)));
}
示例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());
}
示例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();
}