src/com/google/javascript/jscomp/TypeCheck.java
/** Checks an interface, which may be either an ES5-style FUNCTION node, or a CLASS node. */
Checks an interface, which may be either an ES5-style FUNCTION node, or a CLASS node.
Checks an interface which may be either an ES5 - style FUNCTION node or a CLASS node .
private void checkInterface(NodeTraversal t, Node n, FunctionType functionType) {
    for (ObjectType extInterface : functionType.getExtendedInterfaces()) {
      if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) {
        compiler.report(
            t.makeError(n, CONFLICTING_EXTENDED_TYPE, "interface", getBestFunctionName(n)));
      }
    }
    if (functionType.getExtendedInterfacesCount() > 1) {
      HashMap<String, ObjectType> properties = new HashMap<>();
      LinkedHashMap<String, ObjectType> currentProperties = new LinkedHashMap<>();
      for (ObjectType interfaceType : functionType.getExtendedInterfaces()) {
        currentProperties.clear();
        checkInterfaceConflictProperties(t, n, getBestFunctionName(n),
            properties, currentProperties, interfaceType);
        properties.putAll(currentProperties);
      }
    }
    List<FunctionType> loopPath = functionType.checkExtendsLoop();
    if (loopPath != null) {
      String strPath = "";
      for (int i = 0; i < loopPath.size() - 1; i++) {
        strPath += loopPath.get(i).getDisplayName() + " -> ";
      }
      strPath += Iterables.getLast(loopPath).getDisplayName();
      compiler.report(t.makeError(n, INTERFACE_EXTENDS_LOOP,
          loopPath.get(0).getDisplayName(), strPath));
    }
  }
private void checkInterface ( NodeTraversal t , Node n , FunctionType functionType ) { for ( ObjectType extInterface : functionType . getExtendedInterfaces ( ) ) { if ( extInterface . getConstructor ( ) != null && ! extInterface . getConstructor ( ) . isInterface ( ) ) { compiler . report ( t . makeError ( n , CONFLICTING_EXTENDED_TYPE , "interface" , getBestFunctionName ( n ) ) ) ; } } if ( functionType . getExtendedInterfacesCount ( ) > 1 ) { HashMap < String , ObjectType > properties = new HashMap < > ( ) ; LinkedHashMap < String , ObjectType > currentProperties = new LinkedHashMap < > ( ) ; for ( ObjectType interfaceType : functionType . getExtendedInterfaces ( ) ) { currentProperties . clear ( ) ; checkInterfaceConflictProperties ( t , n , getBestFunctionName ( n ) , properties , currentProperties , interfaceType ) ; properties . putAll ( currentProperties ) ; } } List < FunctionType > loopPath = functionType . checkExtendsLoop ( ) ; if ( loopPath != null ) { String strPath = "" ; for ( int i = 0 ; i < loopPath . size ( ) - 1 ; i ++ ) { strPath += loopPath . get ( i ) . getDisplayName ( ) + " -> " ; } strPath += Iterables . getLast ( loopPath ) . getDisplayName ( ) ; compiler . report ( t . makeError ( n , INTERFACE_EXTENDS_LOOP , loopPath . get ( 0 ) . getDisplayName ( ) , strPath ) ) ; } }
Checks an interface, which may be either an ES5-style FUNCTION node, or a CLASS node.
Checks an interface which may be either an ES5 - style FUNCTION node or a CLASS node .
// Interface must extend only interfaces // Check whether the extended interfaces have any conflicts // Only check when extending more than one interfaces