private lombok.ast.Block toBlock(Statement[] statements) { lombok.ast.Block block = new lombok.ast.Block(); fillList(statements, block.rawContents(), FlagKey.AS_STATEMENT); return block; }
private lombok.ast.Block toBlock(Statement[] statements) { lombok.ast.Block block = new lombok.ast.Block(); fillList(statements, block.rawContents(), FlagKey.AS_STATEMENT); return block; }
private lombok.ast.Block toBlock(Statement[] statements) { lombok.ast.Block block = new lombok.ast.Block(); fillList(statements, block.rawContents(), FlagKey.AS_STATEMENT); return block; }
public Node createBlock(List<Node> statements) { Block block = new Block(); if (statements != null) for (Node s : statements) { if (s != null) block.rawContents().addToEnd(s); } return posify(block); }
public Node createBlock(List<Node> statements) { Block block = new Block(); if (statements != null) for (Node s : statements) { if (s != null) block.rawContents().addToEnd(s); } return posify(block); }
public Node createBlock(List<Node> statements) { Block block = new Block(); if (statements != null) for (Node s : statements) { if (s != null) block.rawContents().addToEnd(s); } return posify(block); }
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
private void initializersMustCompleteNormally(Node rawBlock) { if (!(rawBlock instanceof Block)) return; for (Node s : ((Block)rawBlock).rawContents()) { if (s instanceof Throw) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain throws statements.")); if (s instanceof Return) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain return statements.")); } }
private void initializersMustCompleteNormally(Node rawBlock) { if (!(rawBlock instanceof Block)) return; for (Node s : ((Block)rawBlock).rawContents()) { if (s instanceof Throw) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain throws statements.")); if (s instanceof Return) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain return statements.")); } }
private void initializersMustCompleteNormally(Node rawBlock) { if (!(rawBlock instanceof Block)) return; for (Node s : ((Block)rawBlock).rawContents()) { if (s instanceof Throw) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain throws statements.")); if (s instanceof Return) s.addMessage(error(INITIALIZERS_INITIALIZER_MUST_COMPLETE_NORMALLY, "Initializers may not contain return statements.")); } }
@Override public void visitBlock(JCBlock node) { Node n; Block b = new Block(); fillList(node.stats, b.rawContents()); setPos(node, b); if (hasFlag(FlagKey.BLOCKS_ARE_INITIALIZERS)) { if ((node.flags & Flags.STATIC) != 0) { n = setPos(node, new StaticInitializer().astBody(b)); } else { // For some strange reason, solitary ; in a type body are represented not as JCSkips, but as JCBlocks with no endpos. Don't ask me why! if (b.rawContents().isEmpty() && node.endpos == -1) { n = setPos(node, new EmptyDeclaration()); } else { n = setPos(node, new InstanceInitializer().astBody(b)); } } } else { n = b; } set(node, n); }
@Override public void visitBlock(JCBlock node) { Node n; Block b = new Block(); fillList(node.stats, b.rawContents()); setPos(node, b); if (hasFlag(FlagKey.BLOCKS_ARE_INITIALIZERS)) { if ((node.flags & Flags.STATIC) != 0) { n = setPos(node, new StaticInitializer().astBody(b)); } else { // For some strange reason, solitary ; in a type body are represented not as JCSkips, but as JCBlocks with no endpos. Don't ask me why! if (b.rawContents().isEmpty() && node.endpos == -1) { n = setPos(node, new EmptyDeclaration()); } else { n = setPos(node, new InstanceInitializer().astBody(b)); } } } else { n = b; } set(node, n); }
@Override public void visitSwitch(JCSwitch node) { Switch s = new Switch(); JCExpression cond = node.getExpression(); setConversionPositionInfo(s, "()", getPosition(cond)); s.rawCondition(toTree(removeParens(cond))); Block b = new Block(); s.astBody(b); for (JCCase c : node.getCases()) { JCExpression rawExpr = c.getExpression(); if (rawExpr == null) b.rawContents().addToEnd(setPos(c, new Default())); else b.rawContents().addToEnd(setPos(c, new Case().rawCondition(toTree(rawExpr)))); fillList(c.getStatements(), b.rawContents()); } set(node, s); }
@Override public void visitSwitch(JCSwitch node) { Switch s = new Switch(); JCExpression cond = node.getExpression(); setConversionPositionInfo(s, "()", getPosition(cond)); s.rawCondition(toTree(removeParens(cond))); Block b = new Block(); s.astBody(b); for (JCCase c : node.getCases()) { JCExpression rawExpr = c.getExpression(); if (rawExpr == null) b.rawContents().addToEnd(setPos(c, new Default())); else b.rawContents().addToEnd(setPos(c, new Case().rawCondition(toTree(rawExpr)))); fillList(c.getStatements(), b.rawContents()); } set(node, s); }
@Override public void visitSwitch(JCSwitch node) { Switch s = new Switch(); JCExpression cond = node.getExpression(); setConversionPositionInfo(s, "()", getPosition(cond)); s.rawCondition(toTree(removeParens(cond))); Block b = new Block(); s.astBody(b); for (JCCase c : node.getCases()) { JCExpression rawExpr = c.getExpression(); if (rawExpr == null) b.rawContents().addToEnd(setPos(c, new Default())); else b.rawContents().addToEnd(setPos(c, new Case().rawCondition(toTree(rawExpr)))); fillList(c.getStatements(), b.rawContents()); } set(node, s); }
@Override public boolean visitBlock(Block node) { formatter.buildBlock(node); formatter.append("{"); formatter.buildBlock(null); visitAll(node.rawContents(), "", "", ""); formatter.closeBlock(); formatter.append("}"); formatter.closeBlock(); return true; }
@Override public boolean visitBlock(Block node) { formatter.buildBlock(node); formatter.append("{"); formatter.buildBlock(null); visitAll(node.rawContents(), "", "", ""); formatter.closeBlock(); formatter.append("}"); formatter.closeBlock(); return true; }
@Override public boolean visitBlock(Block node) { formatter.buildBlock(node); formatter.append("{"); formatter.buildBlock(null); visitAll(node.rawContents(), "", "", ""); formatter.closeBlock(); formatter.append("}"); formatter.closeBlock(); return true; }