@Override public Iterable<ObjectType> getCtorImplementedInterfaces() { return referencedObjType == null ? Collections.<ObjectType>emptyList() : referencedObjType.getCtorImplementedInterfaces(); }
@Override public Iterable<ObjectType> getCtorImplementedInterfaces() { return referencedObjType == null ? Collections.<ObjectType>emptyList() : referencedObjType.getCtorImplementedInterfaces(); }
/** * Detects cycles in either the implicit prototype chain, or the implemented/extended * interfaces.<p> * * @return True iff a cycle was detected. */ final boolean detectInheritanceCycle() { // TODO(dimvar): This should get moved to preventing cycles in FunctionTypeBuilder // rather than removing them here after they have been created. // Also, this doesn't do the right thing for extended interfaces, though that is // masked by another bug. return detectImplicitPrototypeCycle() || Iterables.contains(this.getCtorImplementedInterfaces(), this) || Iterables.contains(this.getCtorExtendedInterfaces(), this); }
@Override public Iterable<ObjectType> getCtorImplementedInterfaces() { LinkedHashSet<ObjectType> resolvedImplementedInterfaces = new LinkedHashSet<>(); for (ObjectType obj : getReferencedObjTypeInternal().getCtorImplementedInterfaces()) { resolvedImplementedInterfaces.add(obj.visit(replacer).toObjectType()); } return resolvedImplementedInterfaces; }
/** * Detects cycles in either the implicit prototype chain, or the implemented/extended * interfaces.<p> * * @return True iff a cycle was detected. */ final boolean detectInheritanceCycle() { if (detectImplicitPrototypeCycle() || Iterables.contains(this.getCtorImplementedInterfaces(), this)) { return true; } FunctionType fnType = this.getConstructor(); return fnType != null && fnType.checkExtendsLoop() != null; }
/** * Find the property that's being overridden on this type, if any. * * <p>Said property could be a method, field, getter, or setter. We don't distinguish between * these when looking up a property type. */ private JSType findOverriddenProperty( ObjectType ownerType, String propName, TemplateTypeMap typeMap) { JSType result = null; // First, check to see if the property is implemented // on a superclass. JSType propType = ownerType.getPropertyType(propName); if (propType != null && !propType.isUnknownType()) { result = propType; } else { // If it's not, then check to see if it's implemented // on an implemented interface. for (ObjectType iface : ownerType.getCtorImplementedInterfaces()) { propType = iface.getPropertyType(propName); if (propType != null && !propType.isUnknownType()) { result = propType; break; } } } if (result != null && typeMap != null && !typeMap.isEmpty()) { result = result.visit(new TemplateTypeMapReplacer(typeRegistry, typeMap)); } return result; }
/** * Find the function that's being overridden on this type, if any. */ private FunctionType findOverriddenFunction( ObjectType ownerType, String propName, TemplateTypeMap typeMap) { FunctionType result = null; // First, check to see if the property is implemented // on a superclass. JSType propType = ownerType.getPropertyType(propName); if (propType != null && propType.isFunctionType()) { result = propType.toMaybeFunctionType(); } else { // If it's not, then check to see if it's implemented // on an implemented interface. for (ObjectType iface : ownerType.getCtorImplementedInterfaces()) { propType = iface.getPropertyType(propName); if (propType != null && propType.isFunctionType()) { result = propType.toMaybeFunctionType(); break; } } } if (result != null && typeMap != null && !typeMap.isEmpty()) { result = result.visit( new TemplateTypeMapReplacer(typeRegistry, typeMap)) .toMaybeFunctionType(); } return result; }