public class NoType extends NoObjectType
var x = null;
if (x) {
f(x);
}
We need to be able to assign x a type within the f(x)
call. Since it has no possible type, we assign x the NoType,
so that f(x) is legal no matter what the type of f's
first argument is.FunctionType.BuilderJSType.HasPropertyKind, JSType.Nullability, JSType.SubtypingMode, JSType.TypePairtemplateTypeMap| Modifier and Type | Method and Description |
|---|---|
BooleanLiteralSet |
getPossibleToBooleanOutcomes()
Computes the set of possible outcomes of the
ToBoolean predicate
for this type. |
boolean |
isNoObjectType() |
boolean |
isNoType() |
boolean |
isNullable()
Tests whether this type is nullable.
|
boolean |
isVoidable()
Tests whether this type is voidable.
|
<T> T |
visit(Visitor<T> visitor)
Visit this type with the given visitor.
|
getConstructor, getImplicitPrototype, getReferenceName, matchesNumberContext, matchesObjectContext, matchesStringContext, matchesSymbolContext, removeProperty, setPropertyJSDocInfo, toMaybeFunctionTypeacceptsArguments, builder, canBeCalled, checkExtendsLoop, clearCachedValues, forgetParameterAndReturnTypes, getAllImplementedInterfaces, getAncestorInterfaces, getBindReturnType, getClosurePrimitive, getConstructorOnlyTemplateParameters, getDirectSubTypes, getExtendedInterfaces, getExtendedInterfacesCount, getImplementedInterfaces, getInstanceType, getMaxArity, getMinArity, getOwnImplementedInterfaces, getOwnPropertyNames, getParameters, getParametersNode, getParameterTypes, getPropertyType, getPropertyTypeMap, getPrototype, getPrototypeProperty, getReturnType, getSlot, getSource, getSuperClassConstructor, getTypeOfThis, hasCachedValues, hasEqualCallType, hasImplementedInterfaces, hasInstanceType, hasProperties, isAbstract, isConstructor, isInstanceType, isInterface, isOrdinaryFunction, isReturnTypeInferred, isStructuralInterface, makesDicts, makesStructs, setDict, setExplicitUnrestricted, setExtendedInterfaces, setImplementedInterfaces, setImplicitMatch, setPrototypeBasedOn, setSource, setStructgetCtorExtendedInterfaces, getCtorImplementedInterfaces, getOwnerFunction, getTemplateParamCount, isAnonymous, isNativeObjectType, matchConstraint, matchRecordTypeConstraint, setPropertyNode, unboxesTocast, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, findClosestDefinition, findPropertyTypeWithoutConsideringTemplateTypes, getClosestDefiningType, getDisplayName, getEnumeratedTypeOfEnumObject, getImplicitPrototypeChain, getJSDocInfo, getNormalizedReferenceName, getOwnPropertyDefSite, getOwnPropertyJSDocInfo, getOwnPropertyKind, getOwnSlot, getPropertiesCount, getPropertyDefSite, getPropertyJSDocInfo, getPropertyKind, getPropertyNames, getPropertyNode, getRawType, getTemplateTypes, getTopMostDefiningType, hasOwnProperty, hasReferenceName, isAmbiguousObject, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, isStructuralType, isUnknownType, setJSDocInfo, testForEqualityareIdentical, assertFunctionType, assertObjectType, autobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, collapseUnion, containsReferenceAncestor, dereference, differsFrom, equals, findPropertyType, getEnumeratedTypeOfEnumElement, getGreatestSubtype, getGreatestSubtypeWithProperty, getLeastSupertype, getPropertyKind, getRestrictedTypeGivenOutcome, getTemplateTypeMap, getTypeParameters, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, getUnionMembers, hasAnyTemplateTypes, hasDisplayName, hashCode, hasProperty, isAllType, isArrayType, isBooleanObjectType, isBooleanValueType, isBoxableScalar, isCheckedUnknownType, isDateType, isDict, isEmptyType, isEnumElementType, isEnumType, isExplicitlyVoidable, isFunctionType, isGlobalThisType, isLiteralObject, isNamedType, isNominalConstructor, isNominalType, isNoResolvedType, isNullType, isNumber, isNumberObjectType, isNumberValueType, isObjectType, isRawTypeOfTemplatizedType, isRecordType, isRegexpType, isResolved, isSomeUnknownType, isString, isStringObjectType, isStringValueType, isStruct, isSubtype, isSubtype, isSubtypeOf, isSubtypeOf, isSubtypeWithoutStructuralTyping, isSuccessfullyResolved, isSymbol, isSymbolObjectType, isSymbolValueType, isTemplateType, isTemplatizedType, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isUnsuccessfullyResolved, isVoidType, loosenTypecheckingDueToForwardReferencedSupertype, mergeSupertypeTemplateTypes, resolve, restrictByNotNull, restrictByNotNullOrUndefined, restrictByNotUndefined, setValidator, toAnnotationString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toMaybeRecordType, toMaybeTemplateType, toMaybeTemplatizedType, toMaybeUnionType, toObjectType, toStringpublic final boolean isNoObjectType()
isNoObjectType in class NoObjectTypepublic final boolean isNullable()
JSTypeisNullable in class JSTypepublic final boolean isVoidable()
JSTypeisVoidable in class JSTypepublic final 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 ObjectTypepublic final <T> T visit(Visitor<T> visitor)
JSTypevisit in class NoObjectTypeVisitorCopyright © 2009-2020 Google. All Rights Reserved.