public class NoObjectType extends FunctionType
var x = function() {};
if (x instanceof Array) {
f(x);
}
We need to be able to assign x a type within the f(x)
call. It has no possible type, but x would not be legal if f
expected a string. So we assign it the NoObjectType.JSType.TypePairEMPTY_TYPE_COMPONENT, ENUMDECL, NOT_A_CLASS, NOT_A_TYPE, NOT_ENUMDECL, templateTypeMap, UNKNOWN_NAME| Modifier and Type | Method and Description |
|---|---|
FunctionType |
getConstructor()
Gets this object's constructor.
|
ObjectType |
getImplicitPrototype()
Gets the implicit prototype (a.k.a.
|
String |
getReferenceName()
Gets the reference name for this object.
|
int |
hashCode() |
boolean |
isNoObjectType() |
boolean |
isSubtype(JSType that)
A function is a subtype of another if their call methods are related via
subtyping and
this is a subtype of that with regard to
the prototype chain. |
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 |
setPropertyJSDocInfo(String propertyName,
JSDocInfo info)
Sets the docInfo for the specified property from the
JSDocInfo on its definition. |
FunctionType |
toMaybeFunctionType()
Downcasts this to a FunctionType, or returns null if this is not
a function.
|
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
canBeCalled, clearCachedValues, cloneWithoutArrowType, extendTemplateTypeMapBasedOn, getAllExtendedInterfaces, getAllImplementedInterfaces, getBindReturnType, getExtendedInterfaces, getExtendedInterfacesCount, getImplementedInterfaces, getInstanceType, getMaxArguments, getMinArguments, getOwnImplementedInterfaces, getOwnPropertyNames, getParameters, getParametersNode, getPropertyType, getPrototype, getReturnType, getSlot, getSource, getSubTypes, getSuperClassConstructor, getTopDefiningInterface, getTopMostDefiningType, getTypeOfThis, hasAnyTemplateTypesInternal, hasCachedValues, hasEqualCallType, hasImplementedInterfaces, hasInstanceType, isConstructor, isInstanceType, isInterface, isOrdinaryFunction, isReturnTypeInferred, makesDicts, makesStructs, setDict, setExtendedInterfaces, setImplementedInterfaces, setPrototypeBasedOn, setSource, setStruct, toDebugHashCodeStringgetCtorExtendedInterfaces, getCtorImplementedInterfaces, getOwnerFunction, hasReferenceName, isAnonymous, isNativeObjectType, matchConstraint, matchRecordTypeConstraint, unboxesTocast, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, findPropertyType, getDisplayName, getJSDocInfo, getNormalizedReferenceName, getOwnPropertyJSDocInfo, getOwnSlot, getParentScope, getPossibleToBooleanOutcomes, getPropertiesCount, getPropertyNames, getPropertyNode, getRootNode, getTemplateTypes, hasOwnProperty, hasProperty, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, isUnknownType, setJSDocInfo, testForEqualityautobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, clearResolved, collapseUnion, dereference, differsFrom, equals, extendTemplateTypeMap, getGreatestSubtype, getLeastSupertype, getRestrictedTypeGivenToBooleanOutcome, getTemplateTypeMap, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, hasAnyTemplateTypes, hasDisplayName, isAllType, isArrayType, isBooleanObjectType, isBooleanValueType, isCheckedUnknownType, isDateType, isDict, isEmptyType, isEnumElementType, isEnumType, isEquivalent, isEquivalentTo, isFunctionType, isGlobalThisType, isInvariant, isNominalConstructor, isNominalType, isNoResolvedType, isNoType, isNullable, isNullType, isNumber, isNumberObjectType, isNumberValueType, isRecordType, isRegexpType, isResolved, isString, isStringObjectType, isStringValueType, isStruct, isTemplateType, isTemplatizedType, isUnionType, isVoidType, matchesInt32Context, matchesUint32Context, resolve, restrictByNotNullOrUndefined, setValidator, toAnnotationString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeRecordType, toMaybeTemplateType, toMaybeTemplateType, toMaybeTemplatizedType, toMaybeTemplatizedType, toMaybeUnionType, toObjectType, toStringpublic boolean isSubtype(JSType that)
FunctionTypethis is a subtype of that with regard to
the prototype chain.isSubtype in class FunctionTypethis <: thatpublic FunctionType toMaybeFunctionType()
JSTypetoMaybeFunctionType in class FunctionTypepublic boolean isNoObjectType()
isNoObjectType in class JSTypepublic ObjectType getImplicitPrototype()
ObjectType[[Prototype]] property).getImplicitPrototype in class PrototypeObjectTypepublic String getReferenceName()
ObjectTypegetReferenceName in class PrototypeObjectTypenull if this is an anonymous
objectpublic boolean matchesNumberContext()
JSTypematchesNumberContext in class PrototypeObjectTypepublic 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 PrototypeObjectTypepublic 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 PrototypeObjectTypepublic int hashCode()
hashCode in class FunctionTypepublic boolean removeProperty(String name)
ObjectTyperemoveProperty in class PrototypeObjectTypename - the property's namepublic void setPropertyJSDocInfo(String propertyName, JSDocInfo info)
ObjectTypeJSDocInfo on its definition.setPropertyJSDocInfo in class PrototypeObjectTypeinfo - JSDocInfo for the property definition. May be
null.public <T> T visit(Visitor<T> visitor)
JSTypevisit in class FunctionTypeVisitorpublic FunctionType getConstructor()
ObjectTypegetConstructor in class PrototypeObjectTypenull if it is a native
object (constructed natively v.s. by instantiation of a function)Copyright © 2009-2014 Google. All Rights Reserved.