src/com/google/javascript/rhino/jstype/PrototypeObjectType.java
/** Determines if typeA is a subtype of typeB */
Determines if typeA is a subtype of typeB
Determines if typeA is a subtype of typeB
private static boolean isSubtype(ObjectType typeA, RecordType typeB,
      ImplCache implicitImplCache, SubtypingMode subtypingMode) {
    for (String property : typeB.getOwnPropertyNames()) {
      if (!typeA.hasProperty(property)) {
        return false;
      }
      JSType propA = typeA.getPropertyType(property);
      JSType propB = typeB.getPropertyType(property);
      if (!propA.isSubtype(propB, implicitImplCache, subtypingMode)) {
        return false;
      }
    }
    return true;
  }
private static boolean isSubtype ( ObjectType typeA , RecordType typeB , ImplCache implicitImplCache , SubtypingMode subtypingMode ) { for ( String property : typeB . getOwnPropertyNames ( ) ) { if ( ! typeA . hasProperty ( property ) ) { return false ; } JSType propA = typeA . getPropertyType ( property ) ; JSType propB = typeB . getPropertyType ( property ) ; if ( ! propA . isSubtype ( propB , implicitImplCache , subtypingMode ) ) { return false ; } } return true ; }
Determines if typeA is a subtype of typeB
Determines if typeA is a subtype of typeB
// typeA is a subtype of record type typeB iff: // 1) typeA has all the properties declared in typeB. // 2) And for each property of typeB, its type must be //    a super type of the corresponding property of typeA.