src/com/google/javascript/jscomp/TypeCheck.java
/**
   * Visits a {@link Token#FUNCTION} node.
   *
   * @param t The node traversal object that supplies context, such as the
   * scope chain to use in name lookups as well as error reporting.
   * @param n The node being visited.
   */
Visits a  Token#FUNCTION node.
@param t The node traversal object that supplies context, such as the
scope chain to use in name lookups as well as error reporting.
@param n The node being visited.
Visits a Token#FUNCTION node . @param t The node traversal object that supplies context such as the scope chain to use in name lookups as well as error reporting . @param n The node being visited .
private void visitFunction(NodeTraversal t, Node n) {
    FunctionType functionType = JSType.toMaybeFunctionType(n.getJSType());
    if (functionType.isConstructor()) {
      checkConstructor(t, n, functionType);
    } else if (functionType.isInterface()) {
      checkInterface(t, n, functionType);
    } else if (n.isGeneratorFunction()) {
      JSType returnType = functionType.getReturnType();
      validator.expectGeneratorSupertype(
          t, n, returnType, "A generator function must return a (supertype of) Generator");
    } else if (n.isAsyncFunction()) {
      JSType returnType = functionType.getReturnType();
      validator.expectValidAsyncReturnType(t, n, returnType.restrictByNotNullOrUndefined());
    }
  }
private void visitFunction ( NodeTraversal t , Node n ) { FunctionType functionType = JSType . toMaybeFunctionType ( n . getJSType ( ) ) ; if ( functionType . isConstructor ( ) ) { checkConstructor ( t , n , functionType ) ; } else if ( functionType . isInterface ( ) ) { checkInterface ( t , n , functionType ) ; } else if ( n . isGeneratorFunction ( ) ) { JSType returnType = functionType . getReturnType ( ) ; validator . expectGeneratorSupertype ( t , n , returnType , "A generator function must return a (supertype of) Generator" ) ; } else if ( n . isAsyncFunction ( ) ) { JSType returnType = functionType . getReturnType ( ) ; validator . expectValidAsyncReturnType ( t , n , returnType . restrictByNotNullOrUndefined ( ) ) ; } }
Visits a {@link Token#FUNCTION} node.
Visits a { @link Token#FUNCTION } node .
// A generator function must return a Generator or supertype of Generator // An async function must return a Promise or supertype of Promise