@Override public boolean isStructuralInterface() { return isInterface() && isStructuralInterface; }
@Override public final boolean isStructuralInterface() { return isInterface() && isStructuralInterface; }
/** * sets the current interface type to support structural interface matching (abbr. SMI) * * @param flag indicates whether or not it should support SMI */ public final void setImplicitMatch(boolean flag) { checkState(isInterface()); isStructuralInterface = flag; }
/** * sets the current interface type to support * structural interface matching (abbr. SMI) * @param flag indicates whether or not it should support SMI */ public void setImplicitMatch(boolean flag) { Preconditions.checkState(isInterface()); isStructuralInterface = flag; }
/** * Returns whether this function type has an instance type. */ public boolean hasInstanceType() { return isConstructor() || isInterface(); }
/** Returns whether this function type has an instance type. */ public final boolean hasInstanceType() { return isConstructor() || isInterface(); }
public final void setExtendedInterfaces(List<ObjectType> extendedInterfaces) { if (isInterface()) { this.extendedInterfaces = ImmutableList.copyOf(extendedInterfaces); for (ObjectType extendedInterface : this.extendedInterfaces) { typeOfThis.extendTemplateTypeMap(extendedInterface.getTemplateTypeMap()); } } else { throw new UnsupportedOperationException(); } }
public void setExtendedInterfaces(List<ObjectType> extendedInterfaces) throws UnsupportedOperationException { if (isInterface()) { this.extendedInterfaces = ImmutableList.copyOf(extendedInterfaces); for (ObjectType extendedInterface : this.extendedInterfaces) { typeOfThis.extendTemplateTypeMap( extendedInterface.getTemplateTypeMap()); } } else { throw new UnsupportedOperationException(); } }
private void maybeSetBaseType(FunctionType fnType) { if (!fnType.isInterface() && baseType != null) { fnType.setPrototypeBasedOn(baseType); fnType.extendTemplateTypeMapBasedOn(baseType); } }
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); } } }
private void maybeSetBaseType(FunctionType fnType) { if (!fnType.isInterface() && baseType != null) { fnType.setPrototypeBasedOn(baseType); fnType.extendTemplateTypeMapBasedOn(baseType); } }
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); } } }
/** * 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(); }
/** Gets the symbol for the prototype of the given constructor or interface. */ public Symbol getSymbolForInstancesOf(FunctionType fn) { checkState(fn.isConstructor() || fn.isInterface()); ObjectType pType = fn.getPrototype(); return getSymbolForName(fn.getSource(), pType.getReferenceName()); }
/** Gets the symbol for the given constructor or interface. */ public Symbol getSymbolDeclaredBy(FunctionType fn) { checkState(fn.isConstructor() || fn.isInterface()); ObjectType instanceType = fn.getInstanceType(); return getSymbolForName(fn.getSource(), instanceType.getReferenceName()); }
/** * Gets the symbol for the given constructor or interface. */ public Symbol getSymbolDeclaredBy(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType instanceType = fn.getInstanceType(); return getSymbolForName(fn.getSource(), instanceType.getReferenceName()); }
/** * Gets the symbol for the prototype of the given constructor or interface. */ public Symbol getSymbolForInstancesOf(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType pType = fn.getPrototype(); return getSymbolForName(fn.getSource(), pType.getReferenceName()); }
private void checkPropertyInheritance( NodeTraversal t, Node key, String propertyName, FunctionType ctorType, ObjectType type) { if (ctorType != null && (ctorType.isConstructor() || ctorType.isInterface())) { checkDeclaredPropertyInheritance( t, key.getFirstChild(), ctorType, propertyName, key.getJSDocInfo(), type.getPropertyType(propertyName)); } }
private JSType getInstanceFromPrototype(JSType type) { if (type.isFunctionPrototypeType()) { ObjectType prototype = (ObjectType) type; FunctionType owner = prototype.getOwnerFunction(); if (owner.isConstructor() || owner.isInterface()) { return prototype.getOwnerFunction().getInstanceType(); } } return null; }