void addSubTypeIfNotPresent(FunctionType subType) { if (subTypes == null || !subTypes.contains(subType)) { addSubType(subType); } }
/** * Restricted package-accessible version of {@link #addSubType}, which ensures subtypes are not * duplicated. Generally subtypes are added internally and are guaranteed not to be duplicated, * but this has the possibility of missing unresolved supertypes (typically from externs). To * handle that case, {@link PrototypeObjectType} also adds subclasses after resolution. This * method only adds a subclass to the list if it didn't already add itself to its superclass in * the earlier pass. Ideally, "subclass" here would only refer to classes, but there's an edge * case where interfaces have the {@code Object} constructor added as its "superclass". */ final void addSubClassAfterResolution(FunctionType subClass) { checkArgument(this == subClass.getSuperClassConstructor()); if (!subClass.wasAddedToExtendedConstructorSubtypes) { addSubType(subClass); } }
FunctionType superClass = getSuperClassConstructor(); if (superClass != null) { superClass.addSubType(this); wasAddedToExtendedConstructorSubtypes = true; for (ObjectType interfaceType : getExtendedInterfaces()) { if (interfaceType.getConstructor() != null) { interfaceType.getConstructor().addSubType(this);
FunctionType superClass = getSuperClassConstructor(); if (superClass != null) { superClass.addSubType(this); for (ObjectType interfaceType : getExtendedInterfaces()) { if (interfaceType.getConstructor() != null) { interfaceType.getConstructor().addSubType(this);