code: private boolean isFunctionThatShouldHaveJsDoc(NodeTraversal t, Node function) {
      if (!(t.inGlobalHoistScope() || t.inModuleScope())) {
        // TODO(b/233631820): this should check for the module hoist scope instead
        return false;
      }
      if (NodeUtil.isFunctionDeclaration(function)) {
        return true;
      }
      if (NodeUtil.isNameDeclaration(function.getGrandparent()) || function.getParent().isAssign()) {
        return true;
      }
      if (function.getParent().isExport()) {
        return true;
      }
  
      if (function.getGrandparent().isClassMembers()) {
        Node memberNode = function.getParent();
        if (memberNode.isMemberFunctionDef()) {
          // A constructor with no parameters doesn't need JSDoc,
          // but all other member functions do.
          return !isConstructorWithoutParameters(function);
        } else if (memberNode.isGetterDef() || memberNode.isSetterDef()) {
          return true;
        }
      }
  
      if (function.getGrandparent().isObjectLit()
          && NodeUtil.isCallTo(function.getGrandparent().getParent(), "Polymer")) {
        return true;
      }
  
      return false;
    }
docs: Whether the given function should have JSDoc. True if it's a function declared
  in the global scope, or a method on a class which is declared in the global scope.