Crawls the JSDoc of the given node to find any names in JSDoc
that are implicitly null.
17974
@Override
  public void visit(final NodeTraversal t, final Node n, final Node p) {
    final JSDocInfo info = n.getJSDocInfo();
    if (info == null) {
      return;
    }
    final JSTypeRegistry registry = compiler.getTypeRegistry();

    final List<Node> thrownTypes =
        transform(
            info.getThrownTypes(),
            new Function<JSTypeExpression, Node>() {
              @Override
              public Node apply(JSTypeExpression expr) {
                return expr.getRoot();
              }
            });

    final Scope scope = t.getScope();
    for (Node typeRoot : info.getTypeNodes()) {
      NodeUtil.visitPreOrder(
          typeRoot,
          new NodeUtil.Visitor() {
            @Override
            public void visit(Node node) {
              if (!node.isString()) {
                return;
              }
              if (thrownTypes.contains(node)) {
                return;
              }
              Node parent = node.getParent();
              if (parent != null) {
                switch (parent.getToken()) {
                  case BANG:
                  case QMARK:
                  case THIS: // The names inside function(this:Foo) and
                  case NEW: // function(new:Bar) are already non-null.
                  case TYPEOF: // Names after 'typeof' don't have nullability.
                    return;
                  case PIPE:
                    { // Inside a union
                      Node gp = parent.getParent();
                      if (gp != null && gp.getToken() == Token.QMARK) {
                        return; // Inside an explicitly nullable union
                      }
                      for (Node child : parent.children()) {
                        if ((child.isString() && child.getString().equals("null"))
                            || child.getToken() == Token.QMARK) {
                          return; // Inside a union that contains null or nullable type
                        }
                      }
                      break;
                    }
                  default:
                    break;
                }
              }
              String typeName = node.getString();
              if (typeName.equals("null") || registry.getType(scope, typeName) == null) {
                return;
              }
              JSType type = registry.createTypeFromCommentNode(node);
              if (type.isNullable()) {
                compiler.report(JSError.make(node, IMPLICITLY_NULLABLE_JSDOC, typeName));
              }
            }
          },
          Predicates.alwaysTrue());
    }
  }
676688
private function getNodeIndex( $node )
	{
		for( $i=0; $i<$this->count(); $i++ )
			if( $this->nodes[$i] == $node )
				return $i;
		return NULL;
	}
233712
static <K extends Comparable<K>> void checkNode(Node<K> node) {
        node.checkNode(null, null);
    }
1096887
function  (node, attributeName) {
			if(!node){
				return null;
			}
			if(this.hasAttribute(node, attributeName)){
				return this.getAttribute(node, attributeName);
			}else{
				var parent = node.parentNode;
				if(parent){
					return this.getFirstAncestorAttribute(parent, attributeName);
				}else{
					return null;
				}
			}
		}
652235
def getNodeByName(node, name):
    

    if node is None:
        raise Exception(
            "Cannot search for a child '%s' in a None object" % (name,)
        )
    if not name:
        raise Exception("Unspecified name to find node for.")
    try:
        childNode = node.xpath("*[local-name() = '%s']" % name)[0]
    except:
        return None
    return childNode
1236679
function(node) {
            node = Y.Dom.get(node);
            if (!node) {
                return null;
            }

            return Y.Dom.getNextSiblingBy(node);
        }
1051734
private static void paramNamesOf(Node node, ImmutableList.Builder<Node> names) {
    switch (node.getToken()) {
      case NAME:
        names.add(node);
        break;

      case REST:
      case DEFAULT_VALUE:
        paramNamesOf(node.getFirstChild(), names);
        break;

      case PARAM_LIST:
      case ARRAY_PATTERN:
        for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
          paramNamesOf(child, names);
        }
        break;

      case OBJECT_PATTERN:
        for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
          checkArgument(child.isStringKey() || child.isComputedProp(), child);
          paramNamesOf(child.getLastChild(), names);
        }
        break;

      default:
        checkArgument(false, node);
        break;
    }
  }
458746
private static Node getFirstNonEmptyChild(Node n) {
    for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
      if (c.isBlock()) {
        Node result = getFirstNonEmptyChild(c);
        if (result != null) {
          return result;
        }
      } else if (!c.isEmpty()) {
        return c;
      }
    }
    return null;
  }
46688
private SoyValue visitNullSafeNode(ExprNode node) {
    SoyValue value = visitNullSafeNodeRecurse(node);
    // Transform null sentinel into a normal null value.
    if (value == NullSafetySentinel.INSTANCE) {
      return NullData.INSTANCE;
    }
    return value;
  }
96603
private AbstractNode findFirstNodeByName(final SecurityContext securityContext, final HttpServletRequest request, final String path) throws FrameworkException {

		final String name = PathHelper.getName(path);

		if (!name.isEmpty()) {

			logger.debug("Requested name: {}", name);

			final Query query                  = StructrApp.getInstance(securityContext).nodeQuery();
			final ConfigurationProvider config = StructrApp.getConfiguration();

			if (!possiblePropertyNamesForEntityResolving.isEmpty()) {

				query.and();
				resolvePossiblePropertyNamesForObjectResolution(config, query, name);
				query.parent();
			}


			final List<AbstractNode> results = Iterables.toList(query.getResultStream());

			logger.debug("{} results", results.size());
			request.setAttribute(POSSIBLE_ENTRY_POINTS_KEY, results);

			return (results.size() > 0 ? (AbstractNode) results.get(0) : null);
		}

		return null;
	}
772771
function(node) {
    var doc = '';
    var sibling = node.firstChild;
    var serializer = new XMLSerializer();

    while (sibling) {
      if (this.isElementNode(sibling)) {
        doc += serializer.serializeToString(sibling);
      }
      sibling = sibling.nextSibling;
    }

    return doc !== '' ? doc : null;
  }
407835
function(node, name) {
                var value = this.getStyle(node.getType() + "-" + name, node);
                return value !== null ? value : this.getStyle(name, node);
            }
47861
private String getNodeId(PatriciaTrie.PatriciaNode<V> node) {
        if (node == null) {
            return "null";
        } else {
            return node.getKey();
        }
    }
829110
private DatanodeDescriptor getDatanode(DatanodeID node) {
    if (node == null) {
      return null;
    }
    DatanodeDescriptor ds = null;
    try {
      ds = namesystem.getDatanode(node);
    } catch (Exception e) {
      // probably dead on unregistered datanode
      LOG.warn("Failover - caught exception when getting datanode", e);
      return null;
    }
    return ds;
  }
600338
function(node = this.fch) {
                if (node && node.nxt != this.fch && this.fch)
                    return node.nxt;
                return null;
            }
1170417
private ImmutableList<Element> getNodeListForTagElement(Document dom,
			CrawlElement crawlElement,
			EventableConditionChecker eventableConditionChecker) {

		Builder<Element> result = ImmutableList.builder();

		if (crawlElement.getTagName() == null) {
			return result.build();
		}

		EventableCondition eventableCondition =
				eventableConditionChecker.getEventableCondition(crawlElement.getId());
		// TODO Stefan; this part of the code should be re-factored, Hack-ed it this way to prevent
		// performance problems.
		ImmutableList<String> expressions = getFullXpathForGivenXpath(dom, eventableCondition);

		NodeList nodeList = dom.getElementsByTagName(crawlElement.getTagName());

		for (int k = 0; k < nodeList.getLength(); k++) {

			Element element = (Element) nodeList.item(k);
			boolean matchesXpath =
					elementMatchesXpath(eventableConditionChecker, eventableCondition,
							expressions, element);
			LOG.debug("Element {} matches Xpath={}", DomUtils.getElementString(element),
					matchesXpath);
			/*
			 * TODO Stefan This is a possible Thread-Interleaving problem, as / isChecked can return
			 * false and when needed to add it can return true. / check if element is a candidate
			 */
			String id = element.getNodeName() + ": " + DomUtils.getAllElementAttributes(element);
			if (matchesXpath && !checkedElements.isChecked(id)
					&& !isExcluded(dom, element, eventableConditionChecker)) {
				addElement(element, result, crawlElement);
			} else {
				LOG.debug("Element {} was not added", element);
			}
		}
		return result.build();
	}
1350154
protected void checkNode(@Nullable Node node, Token type) throws MalformedException {
    if (node == null) {
      throw new MalformedException(
          "Expected node type " + type + "; found: null", node);
    }
    if (node.getToken() != type) {
      throw new MalformedException(
          "Expected node type " + type + "; found: " + node.getToken(), node);
    }
  }