public final class TemplatizedType extends ProxyObjectType
Array<string>
.JSType.TypePair
templateTypeMap
Modifier and Type | Method and Description |
---|---|
JSType |
getPropertyType(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,
com.google.javascript.rhino.jstype.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.
|
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
canBeCalled, collapseUnion, findPropertyType, getConstructor, getCtorImplementedInterfaces, getImplicitPrototype, getJSDocInfo, getOwnerFunction, 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, setJSDocInfo, setPropertyJSDocInfo, testForEquality, toDebugHashCodeString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeRecordType, toMaybeTemplateType, toMaybeUnionType, visitReferenceType
cast, clearCachedValues, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, getCtorExtendedInterfaces, getDisplayName, getNormalizedReferenceName, getOwnPropertyJSDocInfo, getOwnPropertyNames, getOwnSlot, getParentScope, getPossibleToBooleanOutcomes, getPropertiesCount, getPropertyNames, getPropertyNode, getPropertyTypeMap, getRootNode, getSlot, hasCachedValues, hasOwnProperty, hasProperty, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, setPropertyNode
autobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, dereference, differsFrom, equals, extendTemplateTypeMap, getGreatestSubtype, getLeastSupertype, getRestrictedTypeGivenToBooleanOutcome, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, hasAnyTemplateTypes, hasDisplayName, isArrayType, isBooleanObjectType, isBooleanValueType, isBottom, isDateType, isEmptyType, isEnumElementType, isEnumType, isEquivalent, isEquivalentTo, isEquivalentTo, isExplicitlyVoidable, isFunctionType, isGlobalThisType, isNamedType, isNominalConstructor, isNullType, isNumber, isNumberObjectType, isNumberValueType, isRecordType, isRegexpType, isResolved, isString, isStringObjectType, isStringValueType, isStructuralInterface, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTemplateType, isTemplatizedType, isUnionType, isVoidable, isVoidType, matchesInt32Context, matchesUint32Context, resolve, restrictByNotNullOrUndefined, setValidator, toAnnotationString, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toNonNullAnnotationString, toObjectType, toString, unboxesTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isBottom, isEquivalentTo, isFunctionType, isSubtypeOf, restrictByNotNullOrUndefined, toMaybeObjectType
public <T> T visit(Visitor<T> visitor)
JSType
visit
in class ProxyObjectType
Visitor
public TemplatizedType toMaybeTemplatizedType()
JSType
toMaybeTemplatizedType
in class ProxyObjectType
public com.google.common.collect.ImmutableList<JSType> getTemplateTypes()
ObjectType
getTemplateTypes
in class ProxyObjectType
TemplatizedType
public JSType getPropertyType(String propertyName)
ObjectType
getPropertyType
in class ObjectType
UnknownType
. This method never
returns null
.public boolean isSubtype(JSType that)
JSType
this
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 ProxyObjectType
this <: that
protected boolean isSubtype(JSType that, com.google.javascript.rhino.jstype.JSType.ImplCache implicitImplCache)
JSType
isSubtype
in class ProxyObjectType
implicitImplCache
- 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.public TemplateTypeMap getTemplateTypeMap()
JSType
getTemplateTypeMap
in class ProxyObjectType
public boolean hasAnyTemplateTypesInternal()
hasAnyTemplateTypesInternal
in class ProxyObjectType
public ObjectType getReferencedType()
Copyright © 2009–2023 Google. All rights reserved.