@Override public Iterable<ObjectType> getCtorExtendedInterfaces() { return getConstructor().getExtendedInterfaces(); }
for (ObjectType extInterface : functionType.getExtendedInterfaces()) { if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) { compiler.report( for (ObjectType interfaceType : functionType.getExtendedInterfaces()) { currentProperties.clear(); checkInterfaceConflictProperties(t, n, getBestFunctionName(n),
@Override public Iterable<ObjectType> getCtorExtendedInterfaces() { return getConstructor().getExtendedInterfaces(); }
Iterator<ObjectType> it = ftype.getExtendedInterfaces().iterator(); emitCommaSeparatedInterfaces(it);
public final Collection<ObjectType> getAncestorInterfaces() { Set<ObjectType> result = new HashSet<>(); if (isConstructor()) { result.addAll((Collection<? extends ObjectType>) getImplementedInterfaces()); } else { result.addAll((Collection<? extends ObjectType>) getExtendedInterfaces()); } return result; }
for (ObjectType extInterface : functionType.getExtendedInterfaces()) { if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) { LinkedHashMap<String, ObjectType> currentProperties = new LinkedHashMap<String, ObjectType>(); for (ObjectType interfaceType : functionType.getExtendedInterfaces()) { currentProperties.clear(); checkInterfaceConflictProperties(t, n, functionPrivateName,
@Override public Iterable<ObjectType> getCtorExtendedInterfaces() { return isFunctionPrototypeType() ? getOwnerFunction().getExtendedInterfaces() : ImmutableList.<ObjectType>of(); }
@Override public Iterable<ObjectType> getCtorExtendedInterfaces() { return isFunctionPrototypeType() ? getOwnerFunction().getExtendedInterfaces() : ImmutableList.<ObjectType>of(); }
private void addRelatedExtendedInterfaces(ObjectType instance, Set<ObjectType> set) { FunctionType constructor = instance.getConstructor(); if (constructor != null) { if (!set.add(instance)) { return; } for (ObjectType interfaceType : constructor.getExtendedInterfaces()) { addRelatedExtendedInterfaces(interfaceType, set); } } }
public List<FunctionType> checkExtendsLoop(HashSet<FunctionType> cache, List<FunctionType> path) { Iterable<ObjectType> iterable = this.getExtendedInterfaces(); if (iterable != null) { for (ObjectType interfaceType : iterable) {
private List<FunctionType> checkExtendsLoop(Set<FunctionType> cache, List<FunctionType> path) { Iterable<ObjectType> iterable = this.getExtendedInterfaces(); if (iterable != null) { for (ObjectType interfaceType : iterable) { FunctionType superConstructor = interfaceType.getConstructor(); if (superConstructor == null) { continue; } if (cache.contains(superConstructor)) { // after detecting a loop, prune and return the path, e.g.,: // A -> B -> C -> D -> C, will be pruned into: // c -> D -> C path.add(superConstructor); while (path.get(0) != superConstructor) { path.remove(0); } return path; } cache.add(superConstructor); path.add(superConstructor); List<FunctionType> result = superConstructor.checkExtendsLoop(cache, path); if (result != null) { return result; } cache.remove(superConstructor); path.remove(path.size() - 1); } } return null; }
private static void updatePropertyTypeMap( FunctionType type, Map<String, JSType> propTypeMap, HashSet<FunctionType> cache) { if (type == null) { return; } // retrieve all property types on the prototype of this class ObjectType prototype = type.getPrototype(); if (prototype != null) { Set<String> propNames = prototype.getOwnPropertyNames(); for (String name : propNames) { if (!propTypeMap.containsKey(name)) { JSType propType = prototype.getPropertyType(name); propTypeMap.put(name, propType); } } } // retrieve all property types from its super class Iterable<ObjectType> iterable = type.getExtendedInterfaces(); if (iterable != null) { for (ObjectType interfaceType : iterable) { FunctionType superConstructor = interfaceType.getConstructor(); if (superConstructor == null || cache.contains(superConstructor)) { continue; } cache.add(superConstructor); updatePropertyTypeMap(superConstructor, propTypeMap, cache); cache.remove(superConstructor); } } }
private static void updatePropertyTypeMap( FunctionType type, Map<String, JSType> propTypeMap, HashSet<FunctionType> cache) { if (type == null) { return; } // retrieve all property types on the prototype of this class ObjectType prototype = type.getPrototype(); if (prototype != null) { Set<String> propNames = prototype.getOwnPropertyNames(); for (String name : propNames) { if (!propTypeMap.containsKey(name)) { JSType propType = prototype.getPropertyType(name); propTypeMap.put(name, propType); } } } // retrieve all property types from its super class Iterable<ObjectType> iterable = type.getExtendedInterfaces(); if (iterable != null) { for (ObjectType interfaceType : iterable) { FunctionType superConstructor = interfaceType.getConstructor(); if (superConstructor == null || cache.contains(superConstructor)) { continue; } cache.add(superConstructor); updatePropertyTypeMap(superConstructor, propTypeMap, cache); cache.remove(superConstructor); } } }
/** * Check whether a type is resolvable in the future * If this has a supertype that hasn't been resolved yet, then we can assume * this type will be OK once the super type resolves. * @param objectType * @return true if objectType is resolvable in the future */ private static boolean hasMoreTagsToResolve(ObjectType objectType) { checkArgument(objectType.isUnknownType()); FunctionType ctor = objectType.getConstructor(); if (ctor != null) { // interface extends interfaces for (ObjectType interfaceType : ctor.getExtendedInterfaces()) { if (!interfaceType.isResolved()) { return true; } } } if (objectType.getImplicitPrototype() != null) { // constructor extends class return !objectType.getImplicitPrototype().isResolved(); } return false; }
/** * Check whether a type is resolvable in the future * If this has a supertype that hasn't been resolved yet, then we can assume * this type will be OK once the super type resolves. * @param objectType * @return true if objectType is resolvable in the future */ private static boolean hasMoreTagsToResolve(ObjectType objectType) { Preconditions.checkArgument(objectType.isUnknownType()); if (objectType.getImplicitPrototype() != null) { // constructor extends class return !objectType.getImplicitPrototype().isResolved(); } else { // interface extends interfaces FunctionType ctor = objectType.getConstructor(); if (ctor != null) { for (ObjectType interfaceType : ctor.getExtendedInterfaces()) { if (!interfaceType.isResolved()) { return true; } } } return false; } }
/** * check whether or not this function type has implemented * the given interface * if this function is an interface, check whether or not * this interface has extended the given interface * @param interfaceType the interface type * @return true if implemented */ public boolean explicitlyImplOrExtInterface(FunctionType interfaceType) { Preconditions.checkArgument(interfaceType.isInterface()); for (ObjectType implementedInterface : getAllImplementedInterfaces()) { FunctionType ctor = implementedInterface.getConstructor(); if (ctor != null && ctor.checkEquivalenceHelper( interfaceType, EquivalenceMethod.IDENTITY)) { return true; } } for (ObjectType implementedInterface : getExtendedInterfaces()) { FunctionType ctor = implementedInterface.getConstructor(); if (ctor != null && ctor.checkEquivalenceHelper( interfaceType, EquivalenceMethod.IDENTITY)) { return true; } else if (ctor != null) { return ctor.explicitlyImplOrExtInterface(interfaceType); } } return false; }
for (ObjectType interfaceType : funType.getExtendedInterfaces()) { sb.append(" * "); appendAnnotation(sb, "extends", interfaceType.toAnnotationString());
for (ObjectType interfaceType : getExtendedInterfaces()) { if (interfaceType.getConstructor() != null) { interfaceType.getConstructor().addSubType(this);
for (ObjectType interfaceType : getExtendedInterfaces()) { if (interfaceType.getConstructor() != null) { interfaceType.getConstructor().addSubType(this);
for (JSType extendedType : type.getExtendedInterfaces()) { visitOnce(extendedType);