List<Block> (final List<ASTNode> children) { final ArrayList<Block> subBlocks = new ArrayList<>(); List<ASTNode> flattenChildren = flattenChildren(children); calculateAlignments(flattenChildren, false); for (int i = 0; i < flattenChildren.size(); i++) { ASTNode childNode = flattenChildren.get(i); if (childNode.getElementType() == GroovyElementTypes.LABELED_STATEMENT) { int start = i; do { i++; } while (i < flattenChildren.size() && flattenChildren.get(i).getElementType() != GroovyElementTypes.LABELED_STATEMENT && flattenChildren.get(i).getElementType() != GroovyTokenTypes.mRCURLY); subBlocks.add( new GrLabelBlock( childNode, flattenChildren.subList(start + 1, i), getIndent(childNode), getChildWrap(childNode), myContext) ); i--; } else { subBlocks.add(myContext.createBlock(childNode, getIndent(childNode), getChildWrap(childNode))); } } return subBlocks; }