code: private void visitFunction(Node n) {
      if (NodeUtil.isEs6Constructor(n)) {
        return; // These will be checked via the CLASS node.
      }
  
      FunctionType functionType = JSType.toMaybeFunctionType(n.getJSType());
      if (functionType.isConstructor()) {
        checkConstructor(n, functionType);
      } else if (functionType.isInterface()) {
        checkInterface(n, functionType);
      } else if (n.isAsyncGeneratorFunction()) {
        // An async generator function must return a AsyncGenerator or supertype of AsyncGenerator
        JSType returnType = functionType.getReturnType();
        validator.expectAsyncGeneratorSupertype(
            n,
            returnType,
            "An async generator function must return a (supertype of) AsyncGenerator");
      } else if (n.isGeneratorFunction()) {
        // A generator function must return a Generator or supertype of Generator
        JSType returnType = functionType.getReturnType();
        validator.expectGeneratorSupertype(
            n, returnType, "A generator function must return a (supertype of) Generator");
  
      } else if (n.isAsyncFunction()) {
        // An async function must return a Promise or supertype of Promise
        JSType returnType = functionType.getReturnType();
        validator.expectValidAsyncReturnType(n, returnType);
      }
    }
docs: Visits a {@link Token#FUNCTION} node.
  
  @param n The node being visited.