@Override public final FunctionType getConstructor() { return referencedObjType == null ? null : referencedObjType.getConstructor(); }
@Override public FunctionType getConstructor() { return referencedObjType == null ? null : referencedObjType.getConstructor(); }
@Override public FunctionType getConstructor() { return primitiveObjectType == null ? null : primitiveObjectType.getConstructor(); }
@Override public FunctionType getConstructor() { return primitiveObjectType == null ? null : primitiveObjectType.getConstructor(); }
/** * Return an object with the same nominal type as obj, * but without any possible extra properties that exist on obj. */ static ObjectType getCanonicalInstance(ObjectType obj) { FunctionType ctor = obj.getConstructor(); return ctor == null ? obj : ctor.getInstanceType(); }
@Override public boolean isStructuralType() { FunctionType constructor = this.getConstructor(); return constructor != null && constructor.isStructuralInterface(); }
@Override public boolean isStructuralType() { FunctionType constructor = this.getConstructor(); return constructor != null && constructor.isStructuralInterface(); }
/** See the comment above on shouldAvoidGeneratingExterns. */ private boolean shouldAvoidGeneratingExterns(ObjectType type) { if (type.getConstructor() == null || type.getConstructor().getSource() == null) return false; return shouldAvoidGeneratingExterns( type.getConstructor().getSource().getSourceFileName(), type.getDisplayName()); }
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); } } }
private boolean isInterface(JSType type) { ObjectType objType = type.toObjectType(); if (objType != null) { JSType constructor = objType.getConstructor(); return constructor != null && constructor.isInterface(); } return false; }
private boolean isInterface(JSType type) { ObjectType objType = type.toObjectType(); if (objType != null) { JSType constructor = objType.getConstructor(); return constructor != null && constructor.isInterface(); } return false; }
public FunctionType getSuperClassConstructor() { ObjectType iproto = getImplicitPrototype(); if (iproto == null) { return null; } iproto = iproto.getImplicitPrototype(); return iproto == null ? null : iproto.getConstructor(); }
private void addRelatedInterfaces(ObjectType instance, Set<ObjectType> interfaces) { FunctionType constructor = instance.getConstructor(); if (constructor != null && constructor.isInterface() && !interfaces.contains(instance)) { interfaces.add(instance); for (ObjectType interfaceType : instance.getCtorExtendedInterfaces()) { addRelatedInterfaces(interfaceType, interfaces); } } }
/** * 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; }
private void addRelatedInterfaces(ObjectType instance, Set<ObjectType> set) { FunctionType constructor = instance.getConstructor(); if (constructor != null) { if (!constructor.isInterface()) { return; } if (!set.add(instance)) { return; } for (ObjectType interfaceType : instance.getCtorExtendedInterfaces()) { addRelatedInterfaces(interfaceType, set); } } }
private String getSourceName(JSType jsType) { FunctionType constructor = jsType.toMaybeObjectType().getConstructor(); if (constructor == null) { return ""; } return NodeUtil.getSourceName(constructor.getSource()); }
/** * 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(); }
private boolean isClassType(Node n) { ObjectType type = n.getJSType().restrictByNotNullOrUndefined().toMaybeObjectType(); if (type != null && type.isInstanceType()) { FunctionType ctor = type.getConstructor(); if (ctor != null) { JSDocInfo info = ctor.getJSDocInfo(); if (info != null && info.isConstructorOrInterface()) { return true; } } } return false; }
private boolean isClassType(Node n) { ObjectType type = n.getJSType().restrictByNotNullOrUndefined().toMaybeObjectType(); if (type != null && type.isInstanceType()) { FunctionType ctor = type.getConstructor(); if (ctor != null) { JSDocInfo info = ctor.getJSDocInfo(); if (info != null && info.isConstructorOrInterface()) { return true; } } } return false; }