@Override public ObjectType getImplicitPrototype() { return referencedObjType == null ? null : referencedObjType.getImplicitPrototype(); }
@Override public final ObjectType getImplicitPrototype() { return referencedObjType == null ? null : referencedObjType.getImplicitPrototype(); }
public ObjectType getParentScope() { return getImplicitPrototype(); }
public FunctionType getSuperClassConstructor() { ObjectType iproto = getImplicitPrototype(); if (iproto == null) { return null; } iproto = iproto.getImplicitPrototype(); return iproto == null ? null : iproto.getConstructor(); }
private static List<ObjectType> getSuperStack(ObjectType a) { List<ObjectType> stack = new ArrayList<>(5); for (ObjectType current = a; current != null; current = current.getImplicitPrototype()) { stack.add(current); } return stack; }
private static List<ObjectType> getSuperStack(ObjectType a) { List<ObjectType> stack = new ArrayList<ObjectType>(5); for (ObjectType current = a; current != null; current = current.getImplicitPrototype()) { stack.add(current); } return stack; }
ObjectType getPrototypeObjectType(ObjectType objectType) { checkNotNull(objectType); if (objectType.isUnknownType()) { // Calling getImplicitPrototype() on the unknown type returns `null`, but we want // the prototype of an unknown type to also be unknown. // TODO(bradfordcsmith): Can we fix this behavior of the unknown type? return objectType; } else { return checkNotNull(objectType.getImplicitPrototype(), "null prototype: %s", objectType); } }
/** Returns the direct parent of this property map. */ PropertyMap getPrimaryParent() { if (parentSource == null) { return null; } ObjectType iProto = parentSource.getImplicitPrototype(); return iProto == null ? null : iProto.getPropertyMap(); }
/** Returns the direct parent of this property map. */ PropertyMap getPrimaryParent() { if (parentSource == null) { return null; } ObjectType iProto = parentSource.getImplicitPrototype(); return iProto == null ? null : iProto.getPropertyMap(); }
private Set<JSType> getTypesToSkipForTypeNonUnion(JSType type) { Set<JSType> types = new HashSet<>(); JSType skipType = type; while (skipType != null) { types.add(skipType); ObjectType objSkipType = skipType.toMaybeObjectType(); if (objSkipType != null) { skipType = objSkipType.getImplicitPrototype(); } else { break; } } return types; }
private Set<JSType> getTypesToSkipForTypeNonUnion(JSType type) { Set<JSType> types = new HashSet<JSType>(); JSType skipType = type; while (skipType != null) { types.add(skipType); ObjectType objSkipType = skipType.toObjectType(); if (objSkipType != null) { skipType = objSkipType.getImplicitPrototype(); } else { break; } } return types; }
private ObjectType getSuperType(FunctionType type) { ObjectType proto = type.getPrototype(); if (proto == null) return null; ObjectType implicitProto = proto.getImplicitPrototype(); if (implicitProto == null) return null; return "Object".equals(implicitProto.getDisplayName()) ? null : implicitProto; }
private boolean matchesPrototype(JSType type, JSType maybePrototype) { ObjectType methodClassObjectType = type.toMaybeObjectType(); if (methodClassObjectType != null) { if (methodClassObjectType.getImplicitPrototype().isEquivalentTo(maybePrototype)) { return true; } } return false; }
private boolean implicitPrototypeChainIsUnknown() { ObjectType p = getImplicitPrototype(); while (p != null) { if (p.isUnknownType()) { return true; } p = p.getImplicitPrototype(); } return false; }
private boolean matchesPrototype(JSType type, JSType maybePrototype) { ObjectType methodClassObjectType = type.toMaybeObjectType(); if (methodClassObjectType != null) { if (methodClassObjectType.getImplicitPrototype().isEquivalentTo( maybePrototype)) { return true; } } return false; }
/** * Returns true if any type in the chain has an implicitCast annotation for * the given property. */ private static boolean propertyIsImplicitCast(ObjectType type, String prop) { for (; type != null; type = type.getImplicitPrototype()) { JSDocInfo docInfo = type.getOwnPropertyJSDocInfo(prop); if (docInfo != null && docInfo.isImplicitCast()) { return true; } } return false; }
/** * Returns true if any type in the chain has an implicitCast annotation for * the given property. */ private static boolean propertyIsImplicitCast(ObjectType type, String prop) { for (; type != null; type = type.getImplicitPrototype()) { JSDocInfo docInfo = type.getOwnPropertyJSDocInfo(prop); if (docInfo != null && docInfo.isImplicitCast()) { return true; } } return false; }
/** * Expect that all properties on interfaces that this type implements are * implemented and correctly typed. */ void expectAllInterfaceProperties(NodeTraversal t, Node n, FunctionType type) { ObjectType instance = type.getInstanceType(); for (ObjectType implemented : type.getAllImplementedInterfaces()) { if (implemented.getImplicitPrototype() != null) { for (String prop : implemented.getImplicitPrototype().getOwnPropertyNames()) { expectInterfaceProperty(t, n, instance, implemented, prop); } } } }
/** * Given a constructor or an interface type, get its superclass constructor * or {@code null} if none exists. */ public FunctionType getSuperClassConstructor() { Preconditions.checkArgument(isConstructor() || isInterface()); ObjectType maybeSuperInstanceType = getPrototype().getImplicitPrototype(); if (maybeSuperInstanceType == null) { return null; } return maybeSuperInstanceType.getConstructor(); }
/** * Given a constructor or an interface type, get its superclass constructor or {@code null} if * none exists. */ @Override public final FunctionType getSuperClassConstructor() { checkArgument(isConstructor() || isInterface()); ObjectType maybeSuperInstanceType = getPrototype().getImplicitPrototype(); if (maybeSuperInstanceType == null) { return null; } return maybeSuperInstanceType.getConstructor(); }