Find BlockStatements which are direct children of BlockStatements.
358804
function findNestedBlocks (ast) {
  var tagged = [];
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type === 'BlockStatement' && parent && parent.type === 'BlockStatement') {
        tagged.push([node, parent]);
      }
    }
  });
  return tagged;
}
531559
def get_children(self):
        
        for expr, var in self.items:
            yield expr
            if var:
                yield var
        yield from self.body
1301975
def listBlockChildren(self, block_name=""):
        
        if (not block_name) or re.search("['%','*']", block_name):
            dbsExceptionHandler("dbsException-invalid-input", "DBSBlock/listBlockChildren. Block_name must be provided." )
        conn = self.dbi.connection()
        try:
            results = self.blockchildlist.execute(conn, block_name)
            return results
        finally:
            if conn:
                conn.close()
1266929
def findPrevStmt(self, block):
        
        stmtEnd = self._prevNonCommentBlock(block)
        stmtStart = self.findStmtStart(stmtEnd)
        return Statement(self._qpart, stmtStart, stmtEnd)
1279279
def dfs(self):
        
        for node in self.children:
            for v in node.dfs:
                yield v
        yield self
129275
def __descendants(self):
        
        return itertools.chain(self.contents,
                               *[c.descendants for c in self.children])
1204569
def children( record, index, key='refs', stop_types=STOP_TYPES ):
    """"""
    result = []
    for ref in record.get( key,[]):
        try:
            record = index[ref]
        except KeyError, err:
            #print 'No record for %s address %s in %s'%(key, ref, record['address'] )
            pass # happens when an unreachable references a reachable that has been compressed out...
        else:
            if record['type'] not in stop_types:
                result.append(  record  )
    return result
12739
@SuppressWarnings("unchecked")
  public static List<Statement> getStatements(MethodNode method) {
    Statement code = method.getCode();
    if (!(code instanceof BlockStatement)) { // null or single statement
      BlockStatement block = new BlockStatement();
      if (code != null) block.addStatement(code);
      method.setCode(block);
    }
    return ((BlockStatement)method.getCode()).getStatements();
  }
511269
private void parseTree(List<Block> sourceBlocks)
    {
        Block matchStartBlock = null;
        int count = 0;
        Block mappingCursor = this.mappingTree.getChildren().get(0);
        Block sourceBlock = sourceBlocks.get(0);
        while (sourceBlock != null) {
            while (mappingCursor != null) {
                if (blockEquals(sourceBlock, mappingCursor)) {
                    if (matchStartBlock == null) {
                        matchStartBlock = sourceBlock;
                    }
                    count++;
                    mappingCursor = mappingCursor.getChildren().get(0);
                    // If we reach the Image Block then we've found a match!
                    if (mappingCursor instanceof ImageBlock) {
                        // Replace the first source block with the image block and remove all other blocks...
                        for (int i = 0; i < count - 1; i++) {
                            matchStartBlock.getParent().removeBlock(matchStartBlock.getNextSibling());
                        }
                        sourceBlock = mappingCursor.clone();
                        matchStartBlock.getParent().replaceChild(sourceBlock, matchStartBlock);
                        mappingCursor = null;
                        matchStartBlock = null;
                        count = 0;
                    } else {
                        // Look for next block match
                        break;
                    }
                } else {
                    mappingCursor = mappingCursor.getNextSibling();
                }
            }
            // Look for a match in children of the source block
            List<Block> filteredSourceBlocks = this.filter.filter(sourceBlock.getChildren());
            if (!filteredSourceBlocks.isEmpty()) {
                parseTree(filteredSourceBlocks);
            } else if (mappingCursor == null) {
                // No match has been found, reset state variables
                mappingCursor = this.mappingTree.getChildren().get(0);
                count = 0;
                matchStartBlock = null;
            }
            sourceBlock = this.filter.getNextSibling(sourceBlock);
        }
    }
156130
@Nullable
    private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) {

        if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) {
            return null;
        }

        List<ScopeBlock> children = sb.getChildren();
        if (children != null) {
            for (ScopeBlock child : children) {
                ScopeBlock foundSb = findScopeBlock(child, pc);
                if (foundSb != null) {
                    return foundSb;
                }
            }
        }
        return sb;
    }
1342262
def get_brothers(block)
      o = []
      i = 0

      while block.has_parent? && i < @env.config[:max_uncle_depth]
        parent = block.get_parent
        children = get_children(parent).select {|c| c != block }
        o.concat children
        block = parent
        i += 1
      end

      o
    end
1306585
def _children(self):
        """"""
        if self.declarations:
            yield self.declarations
        if isinstance(self.condition, CodeExpression):
            yield self.condition
        if self.increment:
            yield self.increment
        for codeobj in self.body._children():
            yield codeobj
895013
@Override
  public Iterable<BlockTemplateMatch> match(JCTree tree, Context context) {
    // TODO(lowasser): consider nonconsecutive matches?
    if (tree instanceof JCBlock) {
      JCBlock block = (JCBlock) tree;
      ImmutableList<JCStatement> targetStatements = ImmutableList.copyOf(block.getStatements());
      return matchesStartingAnywhere(block, 0, targetStatements, context)
          .first()
          .or(List.<BlockTemplateMatch>nil());
    }
    return ImmutableList.of();
  }
651594
def evaluate_block(self, comments):
        """"""

        if self.jsdocs:
            m1 = RE_JSDOC.match(comments)
            if m1:
                lines = []
                for line in m1.group(1).splitlines(True):
                    l = line.lstrip()
                    lines.append(l[1:] if l.startswith('*') else l)
                self.jsdoc_comments.append([''.join(lines), self.line_num, self.current_encoding])
            elif self.blocks:
                self.block_comments.append([comments[2:-2], self.line_num, self.current_encoding])
        elif self.blocks:
            self.block_comments.append([comments[2:-2], self.line_num, self.current_encoding])
543866
def get_children(self):
        """"""
        key = self.CHILDREN_KEY % self.pk
        #children = cache.get(key, None)
        # if children is None:
        children = super(Page, self).get_children()
        #cache.set(key, children)
        return children
1248922
def visit_Block(self, node, frame):
        """"""
        level = 0
        if frame.toplevel:
            # if we know that we are a child template, there is no need to
            # check if we are one
            if self.has_known_extends:
                return
            if self.extends_so_far > 0:
                self.writeline('if parent_template is None:')
                self.indent()
                level += 1

        if node.scoped:
            context = self.derive_context(frame)
        else:
            context = self.get_context_ref()

        if supports_yield_from and not self.environment.is_async and \
           frame.buffer is None:
            self.writeline('yield from context.blocks[%r][0](%s)' % (
                           node.name, context), node)
        else:
            loop = self.environment.is_async and 'async for' or 'for'
            self.writeline('%s event in context.blocks[%r][0](%s):' % (
                           loop, node.name, context), node)
            self.indent()
            self.simple_write('event', frame)
            self.outdent()

        self.outdent(level)
535886
private static ListMultimap<TreeNode, Comment> findBlockComments(CompilationUnit unit) {
    ListMultimap<TreeNode, Comment> blockComments =
        MultimapBuilder.hashKeys().arrayListValues().build();
    for (Comment comment : unit.getCommentList()) {
      if (!comment.isBlockComment()) {
        continue;
      }
      int commentPos = comment.getStartPosition();
      AbstractTypeDeclaration containingType = null;
      int containingTypePos = -1;
      for (AbstractTypeDeclaration type : unit.getTypes()) {
        int typePos = type.getStartPosition();
        if (typePos < 0) {
          continue;
        }
        int typeEnd = typePos + type.getLength();
        if (commentPos > typePos && commentPos < typeEnd && typePos > containingTypePos) {
          containingType = type;
          containingTypePos = typePos;
        }
      }
      blockComments.put(containingType != null ? containingType : unit, comment);
    }
    return blockComments;
  }