public final class TemplatizedType extends ProxyObjectType
Array<string>.JSType.EqCache, JSType.ImplCache, JSType.MatchStatus, JSType.TypePair| Modifier and Type | Field and Description |
|---|---|
(package private) TemplateTypeMapReplacer |
replacer |
private static long |
serialVersionUID |
(package private) com.google.common.collect.ImmutableList<JSType> |
templateTypes |
ALPHA, registry, templateTypeMap| Constructor and Description |
|---|
TemplatizedType(JSTypeRegistry registry,
ObjectType objectType,
com.google.common.collect.ImmutableList<JSType> templateTypes) |
| Modifier and Type | Method and Description |
|---|---|
(package private) JSType |
getGreatestSubtypeHelper(JSType rawThat)
Computes the greatest subtype of two related templatized types.
|
JSType |
getPropertyType(java.lang.String propertyName)
Gets the property type of the property whose name is given.
|
ObjectType |
getReferencedType() |
TemplateTypeMap |
getTemplateTypeMap()
Returns the template type map associated with this type.
|
com.google.common.collect.ImmutableList<JSType> |
getTemplateTypes()
Gets the declared default element type.
|
boolean |
hasAnyTemplateTypesInternal() |
boolean |
isSubtype(JSType that)
Checks whether
this is a subtype of that. |
protected boolean |
isSubtype(JSType that,
JSType.ImplCache implicitImplCache)
checking isSubtype with structural interface matching
|
TemplatizedType |
toMaybeTemplatizedType()
Downcasts this to a TemplatizedType, or returns null if this is not
a function.
|
(package private) java.lang.String |
toStringHelper(boolean forAnnotations) |
(package private) <T> T |
visit(RelationshipVisitor<T> visitor,
JSType that)
Visit the types with the given visitor.
|
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
(package private) boolean |
wrapsSameRawType(JSType that) |
canBeCalled, collapseUnion, defineProperty, findPropertyType, getConstructor, getCtorImplementedInterfaces, getImplicitPrototype, getJSDocInfo, getOwnerFunction, getPropertyMap, getReferencedObjTypeInternal, getReferencedTypeInternal, getReferenceName, getTypeOfThis, hashCode, hasReferenceName, isAllType, isCheckedUnknownType, isConstructor, isDict, isInstanceType, isInterface, isNativeObjectType, isNominalType, isNoObjectType, isNoResolvedType, isNoType, isNullable, isOrdinaryFunction, isStruct, isStructuralType, isUnknownType, matchConstraint, matchesNumberContext, matchesObjectContext, matchesStringContext, removeProperty, resolveInternal, setJSDocInfo, setPropertyJSDocInfo, setReferencedType, testForEquality, toDebugHashCodeString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeRecordType, toMaybeTemplateType, toMaybeUnionType, visitReferenceTypecast, checkStructuralEquivalenceHelper, clearCachedValues, collectPropertyNames, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, detectImplicitPrototypeCycle, detectInheritanceCycle, getCtorExtendedInterfaces, getDisplayName, getNormalizedReferenceName, getOwnPropertyJSDocInfo, getOwnPropertyNames, getOwnSlot, getParentScope, getPossibleToBooleanOutcomes, getPropertiesCount, getPropertyNames, getPropertyNode, getPropertyTypeMap, getRootNode, getSlot, hasCachedValues, hasOwnDeclaredProperty, hasOwnProperty, hasProperty, isFunctionPrototypeType, isImplicitPrototype, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, isStructuralSubtype, setOwnerFunction, setPropertyNodeautobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, checkEquivalenceHelper, checkEquivalenceHelper, dereference, differsFrom, equals, extendTemplateTypeMap, filterNoResolvedType, getGreatestSubtype, getGreatestSubtype, getLeastSupertype, getLeastSupertype, getNativeType, getRestrictedTypeGivenToBooleanOutcome, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, hasAnyTemplateTypes, hasDisplayName, isArrayType, isBooleanObjectType, isBooleanValueType, isBottom, isDateType, isEmptyType, isEnumElementType, isEnumType, isEquivalent, isEquivalentTo, isEquivalentTo, isExemptFromTemplateTypeInvariance, isExplicitlyVoidable, isFunctionType, isGlobalThisType, isNamedType, isNominalConstructor, isNullType, isNumber, isNumberObjectType, isNumberValueType, isRecordType, isRegexpType, isResolved, isString, isStringObjectType, isStringValueType, isStructuralInterface, isSubtypeHelper, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTemplateType, isTemplatizedType, isTheObjectType, isUnionType, isVoidable, isVoidType, matchesInt32Context, matchesUint32Context, resolve, restrictByNotNullOrUndefined, safeResolve, setResolvedTypeInternal, setValidator, testForEqualityHelper, toAnnotationString, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toNonNullAnnotationString, toObjectType, toString, unboxesToclone, finalize, getClass, notify, notifyAll, wait, wait, waitisBottom, isEquivalentTo, isFunctionType, isSubtypeOf, restrictByNotNullOrUndefined, toMaybeObjectTypeprivate static final long serialVersionUID
final com.google.common.collect.ImmutableList<JSType> templateTypes
final TemplateTypeMapReplacer replacer
TemplatizedType(JSTypeRegistry registry, ObjectType objectType, com.google.common.collect.ImmutableList<JSType> templateTypes)
java.lang.String toStringHelper(boolean forAnnotations)
toStringHelper in class ProxyObjectTypeforAnnotations - Whether this is for use in code generator
annotations. Otherwise, it's for warnings.public <T> T visit(Visitor<T> visitor)
JSTypevisit in class ProxyObjectTypeVisitor<T> T visit(RelationshipVisitor<T> visitor, JSType that)
JSTypevisit in class ProxyObjectTypeRelationshipVisitorpublic TemplatizedType toMaybeTemplatizedType()
JSTypetoMaybeTemplatizedType in class ProxyObjectTypepublic com.google.common.collect.ImmutableList<JSType> getTemplateTypes()
ObjectTypegetTemplateTypes in class ProxyObjectTypeTemplatizedTypepublic JSType getPropertyType(java.lang.String propertyName)
ObjectTypegetPropertyType in class ObjectTypeUnknownType. This method never
returns null.public boolean isSubtype(JSType that)
JSTypethis is a subtype of that.Note this function also returns true if this type structurally matches the protocol define by that type (if that type is an interface function type) Subtyping rules:
(T1, …, Tn) <: U if and only
Tk <: U for all k ∈ 1..n.U <: (T1, …, Tn) if and only
if U <: Tk for some index k.O1 is a subtype
of an object O2 if it has more properties
than O2 and all common properties are
pairwise subtypes.isSubtype in class ProxyObjectTypethis <: thatprotected boolean isSubtype(JSType that, JSType.ImplCache implicitImplCache)
JSTypeisSubtype in class ProxyObjectTypeimplicitImplCache - a cache that records the checked
or currently checking type pairs, for example, if previous
checking found that constructor C is a subtype of interface I,
then in the cache, table key <I,C> maps to IMPLEMENT status.boolean wrapsSameRawType(JSType that)
JSType getGreatestSubtypeHelper(JSType rawThat)
public TemplateTypeMap getTemplateTypeMap()
JSTypegetTemplateTypeMap in class ProxyObjectTypepublic boolean hasAnyTemplateTypesInternal()
hasAnyTemplateTypesInternal in class ProxyObjectTypepublic ObjectType getReferencedType()