Given a piece of data, check each node_type that the last_node_type can lead to and act using
    the first whose checker returns true.
184589
def _handle_node(self, data):
    
    next_options = self.graph[self.last_node_type]
    for node_type in next_options:
      checker, handler, *_ = node_type
      if checker(data):
        self.last_node_type = node_type
        self.handle(handler(data), node_type, data)
        return
    raise Exception("Unable to handle data: {}".format(data))
82550
def on_compare(self, node):  # ('left', 'ops', 'comparators')
        """"""
        lval = self.run(node.left)
        out = True
        for op, rnode in zip(node.ops, node.comparators):
            rval = self.run(rnode)
            out = op2func(op)(lval, rval)
            lval = rval
            if self.use_numpy and isinstance(out, numpy.ndarray) and out.any():
                break
            elif not out:
                break
        return out
336040
private Set<Node> check(List<Selector> parts) throws NodeSelectorException {
        Set<Node> result = new LinkedHashSet<Node>();
        result.add(root);
        for (Selector selector : parts) {
            NodeTraversalChecker checker = new TagChecker(selector);
            result = checker.check(result, root);
            if (selector.hasSpecifiers()) {
                for (Specifier specifier : selector.getSpecifiers()) {
                    switch (specifier.getType()) {
                    case ATTRIBUTE:
                        checker = new AttributeSpecifierChecker((AttributeSpecifier) specifier);
                        break;
                    case PSEUDO:
                        if (specifier instanceof PseudoClassSpecifier) {
                            checker = new PseudoClassSpecifierChecker((PseudoClassSpecifier) specifier);
                        } else if (specifier instanceof PseudoNthSpecifier) {
                            checker = new PseudoNthSpecifierChecker((PseudoNthSpecifier) specifier);
                        }
                        
                        break;
                    case NEGATION:
                        final Set<Node> negationNodes = checkNegationSpecifier((NegationSpecifier) specifier);
                        checker = new NodeTraversalChecker() {
                            @Override
                            public Set<Node> check(Set<Node> nodes, Node root) throws NodeSelectorException {
                                Set<Node> set = new LinkedHashSet<Node>(nodes);
                                set.removeAll(negationNodes);
                                return set;
                            }
                        };
                        
                        break;
                    }
                    
                    result = checker.check(result, root);
                    if (result.isEmpty()) {
                        // Bail out early.
                        return result;
                    }
                }
            }
        }
        
        return result;
    }
406495
def if_node(node, indent)
      # Check if we have any condition met, or an else branch
      node[@value].each_with_index do |value, index|
        # If we have a branch that meets the condition, generate code for the
        # children related to that specific branch
        case value
        when node[@value].first then buffer_eval "if #{value}"
        when node[@value].last then buffer_eval "else"
        else buffer_eval "elsif #{value}"
        end

        # Evaluate child nodes
        node[@children][index].each do |child|
          root child, indent
        end
      end

      # End
      buffer_eval "end"
    end
663722
private Node firstOfMode(boolean isData) {
        for (Node p = head; p != null; p = succ(p)) {
            if (!p.isMatched())
                return (p.isData == isData) ? p : null;
        }
        return null;
    }
1053749
def compare(self, node, prev_value=None, prev_index=None):
        
        if prev_value is not None and node.value != prev_value or \
           prev_index is not None and node.index != prev_index:
            raise TestFailed(index=self.index)
490621
private void ensureTyped(Node n, JSType type) {
    // Make sure FUNCTION nodes always get function type.
    checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType());
    if (n.getJSType() == null) {
      n.setJSType(type);
    }
  }
156932
def filter(self, query: str) -> Optional['CompatNodeIterator']:
        
        if not self._last_node:
            return None

        return filter(self._last_node, query)
398403
private void checkNodeRecursive(Node node)
	{
		if (isDangling(node))
		{
			removeNode(node);

			for (Edge edge : node.getUpstream())
			{
				checkNodeRecursive(edge.getSourceNode());
			}
			for (Edge edge : node.getDownstream())
			{
				checkNodeRecursive(edge.getTargetNode());
			}
			for (Node parent : node.getUpperEquivalent())
			{
				checkNodeRecursive(parent);
			}
			for (Node child : node.getLowerEquivalent())
			{
				checkNodeRecursive(child);
			}
		}
	}
1084809
def last(self, node):
        # TODO: check docstring
        
        return self._nodes.index(node) == len(self._nodes) - 1
1206240
private boolean watchNextLowerNode() throws KeeperException, InterruptedException {
        /*
         * Iterate through the sorted list of children and find the given node,
         * then setup a electionWatcher on the previous node if it exists, otherwise the
         * previous of the previous...until we reach the beginning, then we are
         * the lowest node.
         */
        List<String> children = zk.getChildren(dir, false);
        Collections.sort(children);
        ListIterator<String> iter = children.listIterator();
        String me = null;
        //Go till I find myself.
        while (iter.hasNext()) {
            me = ZKUtil.joinZKPath(dir, iter.next());
            if (me.equals(node)) {
                break;
            }
        }
        assert (me != null);
        //Back on me
        iter.previous();
        //Until we have previous nodes and we set a watch on previous node.
        while (iter.hasPrevious()) {
            //Proess my lower nodes and put a watch on whats live
            String previous = ZKUtil.joinZKPath(dir, iter.previous());
            if (zk.exists(previous, electionWatcher) != null) {
                return false;
            }
        }
        return true;
    }
1157424
function checkLastSegment(node) {
            let loc, name;

            /*
             * Skip if it expected no return value or unreachable.
             * When unreachable, all paths are returned or thrown.
             */
            if (!funcInfo.hasReturnValue ||
                funcInfo.codePath.currentSegments.every(isUnreachable) ||
                astUtils.isES5Constructor(node) ||
                isClassConstructor(node)
            ) {
                return;
            }

            // Adjust a location and a message.
            if (node.type === "Program") {

                // The head of program.
                loc = { line: 1, column: 0 };
                name = "program";
            } else if (node.type === "ArrowFunctionExpression") {

                // `=>` token
                loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc.start;
            } else if (
                node.parent.type === "MethodDefinition" ||
                (node.parent.type === "Property" && node.parent.method)
            ) {

                // Method name.
                loc = node.parent.key.loc.start;
            } else {

                // Function name or `function` keyword.
                loc = (node.id || node).loc.start;
            }

            if (!name) {
                name = astUtils.getFunctionNameWithKind(node);
            }

            // Reports.
            context.report({
                node,
                loc,
                messageId: "missingReturn",
                data: { name }
            });
        }
131554
Node<E> last() {
        restartFromTail:
        for (;;)
            for (Node<E> t = tail, p = t, q;;) {
                if ((q = p.next) != null &&
                    (q = (p = q).next) != null)
                    // Check for tail updates every other hop.
                    // If p == q, we are sure to follow tail instead.
                    p = (t != (t = tail)) ? t : q;
                else if (p == t
                         // It is possible that p is NEXT_TERMINATOR,
                         // but if so, the CAS is guaranteed to fail.
                         || casTail(t, p))
                    return p;
                else
                    continue restartFromTail;
            }
    }
43649
function findAncestor(node, predicate) {
  var last = false;
  while (node != null && !(last = predicate(node))) {
    node = node.parentNode;
  }
  return last ? node : null;
}
289703
private void addLastOfType() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, true);
			if (index.index == (index.size-1))
				result.add(node);
		}
	}
529015
function checkASTandNodeArray(ast, nodes) {
  typeCheckObject(ast, 'ast');
  typeCheckArray(nodes, 'nodes');
  nodes.forEach((node, index) => {
    typeCheckObject(node, 'nodes (index: ' + index + ')');
  });
  runValidator(ast, 'ast');
  nodes.forEach((node, index) => {
    runValidator(node, 'nodes (index: ' + index + ')');
  });
}
1085693
def visit_BoolOp(self, node):
        """"""
        if self._is_top and isinstance(node.op, ast.And):
            self._is_top = False
            self._current = self.left
            self.visit(node.values[0])
            self._current = self.right
            for successor in node.values[1:]:
                self.visit(successor)
        else:
            self.generic_visit(node)