public class ProxyObjectType extends ObjectType
NamedType,
TemplatizedType,
Serialized FormJSType.SubtypingMode, JSType.TypePairtemplateTypeMap| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeCalled()
This predicate is used to test whether a given type can be used as the
'function' in a function call.
|
JSType |
collapseUnion()
Gets the least supertype of this that's not a union.
|
JSType |
findPropertyType(String propertyName)
Coerces this type to an Object type, then gets the type of the property
whose name is given.
|
FunctionType |
getConstructor()
Gets this object's constructor.
|
Iterable<ObjectType> |
getCtorExtendedInterfaces()
Gets the interfaces extended by the interface associated with this type.
|
Iterable<ObjectType> |
getCtorImplementedInterfaces()
Gets the interfaces implemented by the ctor associated with this type.
|
ObjectType |
getImplicitPrototype()
Gets the implicit prototype (a.k.a.
|
JSDocInfo |
getJSDocInfo()
Gets the docInfo for this type.
|
FunctionType |
getOwnerFunction()
If this type represents the object in a function's prototype property, return that function.
|
String |
getReferenceName()
Gets the reference name for this object.
|
TemplateTypeMap |
getTemplateTypeMap()
Returns the template type map associated with this type.
|
com.google.common.collect.ImmutableList<JSType> |
getTemplateTypes()
Gets the declared default element type.
|
JSType |
getTypeOfThis() |
boolean |
hasAnyTemplateTypesInternal() |
int |
hashCode() |
boolean |
hasReferenceName() |
boolean |
isAllType() |
boolean |
isCheckedUnknownType() |
boolean |
isConstructor()
Whether this type is a
FunctionType that is a constructor or a
named type that points to such a type. |
boolean |
isDict()
Returns true iff
this can be a dict. |
boolean |
isInstanceType()
Whether this type is an Instance object of some constructor.
|
boolean |
isInterface()
Whether this type is a
FunctionType that is an interface or a named
type that points to such a type. |
boolean |
isNativeObjectType()
Whether this is a built-in object.
|
boolean |
isNominalType()
Whether this type is a nominal type (a named instance object or
a named enum).
|
boolean |
isNoObjectType() |
boolean |
isNoResolvedType() |
boolean |
isNoType() |
boolean |
isNullable()
Tests whether this type is nullable.
|
boolean |
isOrdinaryFunction()
Whether this type is a
FunctionType that is an ordinary function or
a named type that points to such a type. |
boolean |
isStruct()
Returns true iff
this can be a struct. |
boolean |
isStructuralType() |
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,
JSType.SubtypingMode subtypingMode)
checking isSubtype with structural interface matching
|
boolean |
isUnknownType()
We treat this as the unknown type if any of its implicit prototype
properties is unknown.
|
void |
matchConstraint(JSType constraint)
Modify this type so that it matches the specified type.
|
boolean |
matchesNumberContext()
This predicate is used to test whether a given type can appear in a
numeric context, such as an operand of a multiply operator.
|
boolean |
matchesObjectContext()
This predicate is used to test whether a given type can appear in an
Object context, such as the expression in a with statement. |
boolean |
matchesStringContext()
This predicate is used to test whether a given type can appear in a
String context, such as an operand of a string concat (+) operator. |
boolean |
removeProperty(String name)
Removes the declared or inferred property from this ObjectType.
|
void |
setJSDocInfo(JSDocInfo info)
Sets the docInfo for this type from the given
JSDocInfo. |
void |
setPropertyJSDocInfo(String propertyName,
JSDocInfo info)
Sets the docInfo for the specified property from the
JSDocInfo on its definition. |
boolean |
setValidator(com.google.common.base.Predicate<JSType> validator)
Certain types have constraints on them at resolution-time.
|
TernaryValue |
testForEquality(JSType that)
Compares
this and that. |
String |
toDebugHashCodeString()
A hash code function for diagnosing complicated issues
around type-identity.
|
EnumElementType |
toMaybeEnumElementType()
Downcasts this to an EnumElementType, or returns null if this is not an EnumElementType.
|
EnumType |
toMaybeEnumType()
Downcasts this to an EnumType, or returns null if this is not an EnumType.
|
FunctionType |
toMaybeFunctionType()
Downcasts this to a FunctionType, or returns null if this is not
a function.
|
RecordType |
toMaybeRecordType()
Downcasts this to a RecordType, or returns null if this is not
a RecordType.
|
TemplateType |
toMaybeTemplateType()
Downcasts this to a TemplateType, or returns null if this is not
a function.
|
TemplatizedType |
toMaybeTemplatizedType()
Downcasts this to a TemplatizedType, or returns null if this is not
a function.
|
UnionType |
toMaybeUnionType()
Downcasts this to a UnionType, or returns null if this is not a UnionType.
|
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
<T> T |
visitReferenceType(Visitor<T> visitor) |
cast, clearCachedValues, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, getDisplayName, getEnumeratedTypeOfEnumObject, getLegacyResolvedType, getNormalizedReferenceName, getOwnPropertyDefSite, getOwnPropertyJSDocInfo, getOwnPropertyNames, getOwnSlot, getParentScope, getPossibleToBooleanOutcomes, getPropertiesCount, getPropertyDefSite, getPropertyJSDocInfo, getPropertyNames, getPropertyNode, getPropertyType, getPropertyTypeMap, getPrototypeObject, getRawType, getRootNode, getSlot, getSuperClassConstructor, getTopDefiningInterface, hasCachedValues, hasOwnProperty, hasProperty, instantiateGenericsWithUnknown, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, isUnknownObject, normalizeObjectForCheckAccessControls, setPropertyNodeautobox, autoboxAndGetObject, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, containsArray, dereference, differsFrom, equals, extendTemplateTypeMap, getEnumeratedTypeOfEnumElement, getGreatestSubtype, getGreatestSubtypeWithProperty, getLeastSupertype, getRestrictedTypeGivenToBooleanOutcome, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, getUnionMembers, hasAnyTemplateTypes, hasDisplayName, hasUninstantiatedTypeVariables, isArrayType, isBooleanObjectType, isBooleanValueType, isBottom, isBoxableScalar, isDateType, isEmptyType, isEnumElement, isEnumElementType, isEnumObject, isEnumType, isEquivalent, isEquivalentTo, isEquivalentTo, isExplicitlyVoidable, isFunctionType, isGenericObjectType, isGlobalThisType, isInstanceofObject, isLegacyNamedType, isLiteralObject, isNamedType, isNominalConstructor, isNullType, isNumber, isNumberObjectType, isNumberValueType, isObjectType, isPrototypeObject, isRecordType, isRegexpType, isResolved, isSomeUnknownType, isString, isStringObjectType, isStringValueType, isStructuralInterface, isSubtype, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTemplateType, isTemplatizedType, isTop, isTypeVariable, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isVoidable, isVoidType, matchesInt32Context, matchesUint32Context, meetWith, resolve, restrictByNotNullOrUndefined, toAnnotationString, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toNonNullAnnotationString, toObjectType, toString, unboxesToclone, finalize, getClass, notify, notifyAll, wait, wait, waitisLegacyNamedTypeautobox, autoboxAndGetObject, containsArray, getEnumeratedTypeOfEnumElement, getGreatestSubtypeWithProperty, getUnionMembers, hasUninstantiatedTypeVariables, isBooleanValueType, isBottom, isBoxableScalar, isEnumElement, isEnumObject, isEquivalentTo, isFunctionType, isGenericObjectType, isInstanceofObject, isLiteralObject, isNullType, isNumberValueType, isObjectType, isPrototypeObject, isRecordType, isSomeUnknownType, isStringValueType, isStructuralInterface, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTop, isTypeVariable, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isVoidable, isVoidType, meetWith, restrictByNotNullOrUndefined, toAnnotationString, toMaybeObjectType, toNonNullAnnotationStringpublic boolean setValidator(com.google.common.base.Predicate<JSType> validator)
JSType@extends annotation must be an
object. Clients should inject a validator that emits a warning
if the type does not validate, and return false.setValidator in class JSTypepublic String getReferenceName()
ObjectTypegetReferenceName in class ObjectTypenull if this is an anonymous
objectpublic boolean hasReferenceName()
hasReferenceName in class ObjectTypepublic boolean matchesNumberContext()
JSTypematchesNumberContext in class JSTypepublic boolean matchesStringContext()
JSTypeString context, such as an operand of a string concat (+) operator.
All types have at least the potential for converting to String.
When we add externally defined types, such as a browser OM, we may choose
to add types that do not automatically convert to String.matchesStringContext in class JSTypepublic boolean matchesObjectContext()
JSTypeObject context, such as the expression in a with statement.
Most types we will encounter, except notably null, have at least
the potential for converting to Object. Host defined objects can
get peculiar.matchesObjectContext in class JSTypepublic boolean canBeCalled()
JSTypecanBeCalled in class JSTypetrue if this type might be callable.public boolean isStructuralType()
isStructuralType in class ObjectTypepublic boolean isNoObjectType()
isNoObjectType in class JSTypepublic boolean isNoResolvedType()
isNoResolvedType in class JSTypepublic boolean isUnknownType()
ObjectTypeisUnknownType in interface TypeIisUnknownType in class ObjectTypepublic boolean isCheckedUnknownType()
isCheckedUnknownType in class JSTypepublic boolean isNullable()
JSTypeisNullable in interface TypeIisNullable in class JSTypepublic EnumType toMaybeEnumType()
JSTypetoMaybeEnumType in class JSTypepublic boolean isConstructor()
JSTypeFunctionType that is a constructor or a
named type that points to such a type.isConstructor in interface TypeIisConstructor in class JSTypepublic boolean isNominalType()
JSTypeisNominalType in class JSTypepublic boolean isInstanceType()
JSTypeInstanceObjectType.isInstanceType in interface ObjectTypeIisInstanceType in class JSTypepublic boolean isInterface()
JSTypeFunctionType that is an interface or a named
type that points to such a type.isInterface in interface TypeIisInterface in class JSTypepublic boolean isOrdinaryFunction()
JSTypeFunctionType that is an ordinary function or
a named type that points to such a type.isOrdinaryFunction in class JSTypepublic boolean isStruct()
JSTypethis can be a struct.
UnionType overrides the method, assume this is not a union here.public boolean isDict()
JSTypethis can be a dict.
UnionType overrides the method, assume this is not a union here.public boolean isNativeObjectType()
ObjectTypeisNativeObjectType in class ObjectTypepublic RecordType toMaybeRecordType()
JSTypetoMaybeRecordType in class JSTypepublic UnionType toMaybeUnionType()
JSTypetoMaybeUnionType in class JSTypepublic FunctionType toMaybeFunctionType()
JSTypetoMaybeFunctionType in interface TypeItoMaybeFunctionType in class JSTypepublic EnumElementType toMaybeEnumElementType()
JSTypetoMaybeEnumElementType in class JSTypepublic TernaryValue testForEquality(JSType that)
JSTypethis and that.testForEquality in class ObjectTypeTernaryValue.TRUE if the comparison of values of
this type and that always succeed (such as
undefined compared to null)TernaryValue.FALSE if the comparison of values of
this type and that always fails (such as
undefined compared to number)TernaryValue.UNKNOWN if the comparison can succeed or
fail depending on the concrete valuespublic 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.protected boolean isSubtype(JSType that, com.google.javascript.rhino.jstype.JSType.ImplCache implicitImplCache, JSType.SubtypingMode subtypingMode)
JSTypepublic FunctionType getOwnerFunction()
ObjectTypeIgetOwnerFunction in interface ObjectTypeIgetOwnerFunction in class ObjectTypepublic Iterable<ObjectType> getCtorImplementedInterfaces()
ObjectTypegetCtorImplementedInterfaces in class ObjectTypepublic Iterable<ObjectType> getCtorExtendedInterfaces()
ObjectTypegetCtorExtendedInterfaces in class ObjectTypepublic ObjectType getImplicitPrototype()
ObjectType[[Prototype]] property).getImplicitPrototype in class ObjectTypepublic boolean removeProperty(String name)
ObjectTyperemoveProperty in class ObjectTypename - the property's namepublic JSType findPropertyType(String propertyName)
JSTypeObjectType.getPropertyType(java.lang.String), returns null if the property
is not found.findPropertyType in class ObjectTypenull if the current type cannot
have properties, or if the type is not found.public JSDocInfo getJSDocInfo()
ObjectTypegetJSDocInfo in interface TypeIgetJSDocInfo in class ObjectTypepublic void setJSDocInfo(JSDocInfo info)
ObjectTypesetJSDocInfo in class ObjectTypepublic void setPropertyJSDocInfo(String propertyName, JSDocInfo info)
ObjectTypeJSDocInfo on its definition.setPropertyJSDocInfo in class ObjectTypeinfo - JSDocInfo for the property definition. May be
null.public FunctionType getConstructor()
ObjectTypegetConstructor in interface ObjectTypeIgetConstructor in class ObjectTypenull if it is a native
object (constructed natively v.s. by instantiation of a function)public com.google.common.collect.ImmutableList<JSType> getTemplateTypes()
ObjectTypegetTemplateTypes in interface ObjectTypeIgetTemplateTypes in class ObjectTypeTemplatizedTypepublic <T> T visitReferenceType(Visitor<T> visitor)
public <T> T visit(Visitor<T> visitor)
JSTypevisit in class ObjectTypeVisitorpublic String toDebugHashCodeString()
JSTypetoDebugHashCodeString in class JSTypepublic JSType getTypeOfThis()
getTypeOfThis in class ObjectTypepublic JSType collapseUnion()
JSTypecollapseUnion in class JSTypepublic void matchConstraint(JSType constraint)
JSTypematchConstraint in class JSTypepublic TemplatizedType toMaybeTemplatizedType()
JSTypetoMaybeTemplatizedType in class JSTypepublic TemplateType toMaybeTemplateType()
JSTypetoMaybeTemplateType in class JSTypepublic boolean hasAnyTemplateTypesInternal()
public TemplateTypeMap getTemplateTypeMap()
JSTypegetTemplateTypeMap in class JSTypeCopyright © 2009-2017 Google. All Rights Reserved.