public class UnknownType extends ObjectType
Unknown type.JSType.SubtypingMode, JSType.TypePairTypeI.Nullability, TypeI.TypeInferencetemplateTypeMap| 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.
|
FunctionType |
getConstructor()
Gets this object's constructor.
|
String |
getDisplayName()
Returns a user meaningful label for the JSType instance.
|
ObjectType |
getImplicitPrototype()
Gets the implicit prototype (a.k.a.
|
BooleanLiteralSet |
getPossibleToBooleanOutcomes()
Computes the set of possible outcomes of the
ToBoolean predicate
for this type. |
String |
getReferenceName()
Gets the reference name for this object.
|
boolean |
hasDisplayName() |
int |
hashCode() |
boolean |
isCheckedUnknownType() |
boolean |
isNullable()
Tests whether this type is nullable.
|
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.
|
boolean |
isVoidable()
Tests whether this type is voidable.
|
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. |
TernaryValue |
testForEquality(JSType that)
Compares
this and that. |
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
cast, clearCachedValues, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, findPropertyType, getCtorExtendedInterfaces, getCtorImplementedInterfaces, getEnumeratedTypeOfEnumObject, getJSDocInfo, getLegacyResolvedType, getNormalizedReferenceName, getOwnerFunction, getOwnPropertyDefSite, getOwnPropertyJSDocInfo, getOwnPropertyNames, getOwnSlot, getParentScope, getPropertiesCount, getPropertyDefSite, getPropertyJSDocInfo, getPropertyNames, getPropertyNode, getPropertyType, getPropertyTypeMap, getPrototypeObject, getRawType, getRootNode, getSlot, getSuperClassConstructor, getTemplateTypes, getTopDefiningInterface, getTypeOfThis, hasCachedValues, hasOwnProperty, hasProperty, hasReferenceName, instantiateGenericsWithUnknown, isAmbiguousObject, isFunctionPrototypeType, isNativeObjectType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, isStructuralType, normalizeObjectForCheckAccessControls, removeProperty, setJSDocInfo, setPropertyJSDocInfo, setPropertyNodeautobox, autoboxAndGetObject, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, collapseUnion, containsArray, dereference, differsFrom, equals, extendTemplateTypeMap, getEnumeratedTypeOfEnumElement, getGreatestSubtype, getGreatestSubtypeWithProperty, getLeastSupertype, getRestrictedTypeGivenToBooleanOutcome, getTemplateTypeMap, getTypeParameters, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, getUnionMembers, hasAnyTemplateTypes, isAllType, isArrayType, isBooleanObjectType, isBooleanValueType, isBottom, isBoxableScalar, isConstructor, isDateType, isDict, isEmptyType, isEnumElement, isEnumElementType, isEnumObject, isEnumType, isEquivalent, isEquivalentTo, isEquivalentTo, isExplicitlyVoidable, isFullyInstantiated, isFunctionType, isGenericObjectType, isGlobalThisType, isInstanceofObject, isInstanceType, isInterface, isLegacyNamedType, isLiteralObject, isNamedType, isNominalConstructor, isNominalType, isNoObjectType, isNoResolvedType, isNoType, isNullType, isNumber, isNumberObjectType, isNumberValueType, isObjectType, isOrdinaryFunction, isPartiallyInstantiated, isPrototypeObject, isRecordType, isRegexpType, isResolved, isSomeUnknownType, isString, isStringObjectType, isStringValueType, isStruct, isStructuralInterface, isSubtype, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTemplateType, isTemplatizedType, isTop, isTypeVariable, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isVoidType, matchConstraint, matchesInt32Context, matchesUint32Context, meetWith, resolve, restrictByNotNullOrUndefined, setValidator, toAnnotationString, toDebugHashCodeString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toMaybeRecordType, toMaybeTemplateType, toMaybeTemplatizedType, toMaybeUnionType, toObjectType, toString, typeInference, unboxesToclone, finalize, getClass, notify, notifyAll, wait, wait, waitisInstanceType, isLegacyNamedTypeautobox, autoboxAndGetObject, containsArray, getEnumeratedTypeOfEnumElement, getGreatestSubtypeWithProperty, getTypeParameters, getUnionMembers, isBooleanValueType, isBottom, isBoxableScalar, isConstructor, isEnumElement, isEnumObject, isEquivalentTo, isFullyInstantiated, isFunctionType, isGenericObjectType, isInstanceofObject, isInterface, isLiteralObject, isNullType, isNumberValueType, isObjectType, isPartiallyInstantiated, isPrototypeObject, isRecordType, isSomeUnknownType, isStringValueType, isStructuralInterface, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTop, isTypeVariable, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isVoidType, meetWith, restrictByNotNullOrUndefined, toAnnotationString, toMaybeFunctionType, toMaybeObjectType, typeInferencepublic boolean isUnknownType()
ObjectTypeisUnknownType in interface TypeIisUnknownType in class ObjectTypepublic boolean isCheckedUnknownType()
isCheckedUnknownType in class JSTypepublic boolean canBeCalled()
JSTypecanBeCalled in class JSTypetrue if this type might be callable.public boolean matchesNumberContext()
JSTypematchesNumberContext 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 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 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 isNullable()
JSTypeisNullable in interface TypeIisNullable in class JSTypepublic boolean isVoidable()
JSTypeisVoidable in interface TypeIisVoidable in class JSTypepublic 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 <T> T visit(Visitor<T> visitor)
JSTypevisit in class ObjectTypeVisitorpublic ObjectType getImplicitPrototype()
ObjectType[[Prototype]] property).getImplicitPrototype in class ObjectTypepublic 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 String getReferenceName()
ObjectTypegetReferenceName in class ObjectTypenull if this is an anonymous
objectpublic String getDisplayName()
JSTypegetDisplayName in interface TypeIgetDisplayName in class ObjectTypepublic boolean hasDisplayName()
hasDisplayName in class JSTypepublic BooleanLiteralSet getPossibleToBooleanOutcomes()
JSTypeToBoolean predicate
for this type. The ToBoolean predicate is defined by the ECMA-262
standard, 3rd edition. Its behavior for simple types can be
summarized by the following table:
| type | result |
|---|---|
undefined | {false} |
null | {false} |
boolean | {true, false} |
number | {true, false} |
string | {true, false} |
Object | {true} |
getPossibleToBooleanOutcomes in class ObjectTypeCopyright © 2009-2017 Google. All Rights Reserved.