code: public static boolean isNamespaceDecl(Node n) {
      JSDocInfo jsdoc = getBestJSDocInfo(n);
      if (jsdoc != null && !jsdoc.getTypeNodes().isEmpty()) {
        return false;
      }
      // In externs, we allow namespace definitions without @const.
      // This is a worse design than always requiring @const, but it helps with
      // namespaces that are defined in many places, such as gapi.
      // Also, omitting @const in externs is not as confusing as in source code,
      // because assigning an object literal in externs only makes sense when
      // defining a namespace or enum.
      boolean isMarkedConst = n.getParent().isConst() || (jsdoc != null && jsdoc.isConstant());
      if (!n.isFromExterns() && !isMarkedConst) {
        return false;
      }
      Node qnameNode;
      Node initializer;
      if (NodeUtil.isNameDeclaration(n.getParent())) {
        qnameNode = n;
        initializer = n.getFirstChild();
      } else if (n.isExprResult()) {
        Node expr = n.getFirstChild();
        if (!expr.isAssign() || !expr.getFirstChild().isGetProp()) {
          return false;
        }
        qnameNode = expr.getFirstChild();
        initializer = expr.getLastChild();
      } else if (n.isGetProp()) {
        Node parent = n.getParent();
        if (!parent.isAssign() || !parent.getParent().isExprResult()) {
          return false;
        }
        qnameNode = n;
        initializer = parent.getLastChild();
      } else {
        return false;
      }
      if (initializer == null || qnameNode == null) {
        return false;
      }
      if (initializer.isObjectLit()) {
        return true;
      }
      return initializer.isOr()
          && qnameNode.matchesQualifiedName(initializer.getFirstChild())
          && initializer.getLastChild().isObjectLit();
    }
docs: Returns true iff this node defines a namespace, e.g.,
  
  /** @const * / var goog = {};
  /** @const * / var goog = goog || {};
  /** @const * / goog.math = goog.math || {};