code: Map<String, DefineInfo> collectDefines(Node externs, Node root) {
      GlobalNamespace namespace = null;
      if (namespaceSupplier != null) {
        namespace = namespaceSupplier.get();
      }
      if (namespace == null) {
        namespace = new GlobalNamespace(compiler, externs, root);
      }
  
      // namespace =
      //     namespaceSupplier != nul
      //         ? namespaceSupplier.get()
      //         : new GlobalNamespace(compiler, externs, root);
  
      // Find all the global names with a @define annotation
      List<Name> listOfDefines = new ArrayList<>();
      for (Name name : namespace.getNameIndex().values()) {
        Ref decl = name.getDeclaration();
        if (name.getJSDocInfo() != null && name.getJSDocInfo().isDefine()) {
          // Process defines should not depend on check types being enabled,
          // so we look for the JSDoc instead of the inferred type.
          if (isValidDefineType(name.getJSDocInfo().getType())) {
            listOfDefines.add(name);
          } else {
            JSError error = JSError.make(decl.getNode(), INVALID_DEFINE_TYPE_ERROR);
            compiler.report(error);
          }
        } else {
          for (Ref ref : name.getRefs()) {
            if (ref == decl) {
              // Declarations were handled above.
              continue;
            }
  
            Node n = ref.getNode();
            Node parent = ref.getNode().getParent();
            JSDocInfo info = n.getJSDocInfo();
            if (info == null && parent.isVar() && parent.hasOneChild()) {
              info = parent.getJSDocInfo();
            }
  
            if (info != null && info.isDefine()) {
              listOfDefines.add(name);
              break;
            }
          }
        }
      }
  
      CollectDefines pass = new CollectDefines(namespace, listOfDefines);
      NodeTraversal.traverseRoots(compiler, pass, externs, root);
      return pass.allDefines;
    }
docs: Finds all defines, and creates a {@link DefineInfo} data structure for each one.
  
  @return A map of {@link DefineInfo} structures, keyed by name.