@Override public boolean enterLabelNode(final LabelNode labelNode) { enterDefault(labelNode); type("LabeledStatement"); comma(); property("label"); labelNode.getLabel().accept(this); comma(); property("body"); labelNode.getBody().accept(this); return leave(); }
@Override public boolean enterLabelNode(final LabelNode labelNode) { enterDefault(labelNode); type("LabeledStatement"); comma(); property("label", labelNode.getLabelName()); comma(); property("body"); labelNode.getBody().accept(this); return leave(); }
@Override public boolean enterLabelNode(final LabelNode labeledNode) { indent -= TABWIDTH; indent(); indent += TABWIDTH; labeledNode.toString(sb, printTypes); labeledNode.getBody().accept(this); printLocalVariableConversion(labeledNode); return false; }
private static JumpToInlinedFinally createJumpToInlinedFinally(final FunctionNode fn, final List<Block> inlinedFinallies, final Block finallyBlock) { final String labelName = fn.uniqueName(":finally"); final long token = finallyBlock.getToken(); final int finish = finallyBlock.getFinish(); inlinedFinallies.add(new Block(token, finish, new LabelNode(finallyBlock.getFirstStatementLineNumber(), token, finish, labelName, finallyBlock))); return new JumpToInlinedFinally(labelName); }
@Override public boolean enterLabelNode(final LabelNode labeledNode) { indent -= TABWIDTH; indent(); indent += TABWIDTH; labeledNode.toString(sb); labeledNode.getBody().accept(this); return false; }
/** * ContinueStatement : * continue Identifier? ; // [no LineTerminator here] * * See 12.7 * * Parse CONTINUE statement. */ private void continueStatement() { // Capture CONTINUE token. final int continueLine = line; final long continueToken = token; // CONTINUE 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; } final String labelName = labelNode == null ? null : labelNode.getLabelName(); final LoopNode targetNode = lc.getContinueTo(labelName); if (targetNode == null) { throw error(AbstractParser.message("illegal.continue.stmt"), continueToken); } endOfLine(); // Construct and add CONTINUE node. appendStatement(new ContinueNode(continueLine, continueToken, finish, labelName)); }
/** * 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)); }
@Override public Node leaveLabelNode(final LabelNode labelNode) { return addStatement(labelNode); }
@Override public boolean enterLabelNode(final LabelNode labelNode) { labeledBlockBreakLiveLocals.push(lc.getUsedSlotCount()); return true; }
@Override public boolean enterLabelNode(final LabelNode labelNode) { curStat = new LabeledStatementTreeImpl(labelNode, translateBlock(labelNode.getBody())); return false; }
LabeledStatementTreeImpl(final LabelNode node, final StatementTree stat) { super(node); this.name = node.getLabelName(); this.stat = stat; }