private boolean hasAlternate(JSType type, EquivalenceMethod eqMethod, EqCache eqCache) {
   for (JSType alternate : getAlternatesWithoutStructuralTyping()) {
     if (alternate.checkEquivalenceHelper(type, eqMethod, eqCache)) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 2
0
  /**
   * Two function types are equal if their signatures match. Since they don't have signatures, two
   * interfaces are equal if their names match.
   */
  boolean checkFunctionEquivalenceHelper(FunctionType that, EquivalenceMethod eqMethod) {
    if (isConstructor()) {
      if (that.isConstructor()) {
        return this == that;
      }
      return false;
    }
    if (isInterface()) {
      if (that.isInterface()) {
        return getReferenceName().equals(that.getReferenceName());
      }
      return false;
    }
    if (that.isInterface()) {
      return false;
    }

    return typeOfThis.checkEquivalenceHelper(that.typeOfThis, eqMethod)
        && call.checkArrowEquivalenceHelper(that.call, eqMethod);
  }