public final class EnumType extends Namespace implements TypeWithProperties
| Modifier and Type | Class and Description |
|---|---|
private static class |
EnumType.State |
| Modifier and Type | Field and Description |
|---|---|
private JSType |
declaredType |
private JSType |
enumPropType |
private com.google.common.collect.ImmutableSet<java.lang.String> |
props |
private EnumType.State |
state |
private JSTypeExpression |
typeExpr |
name, namespaceType, otherProps| Modifier | Constructor and Description |
|---|---|
private |
EnumType(java.lang.String name,
JSTypeExpression typeExpr,
java.util.Collection<java.lang.String> props) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static boolean |
areSubtypes(JSType t1,
JSType t2,
SubtypeCache subSuperMap) |
protected JSType |
computeJSType(JSTypes commonTypes)
When defining an enum such as
/** @enum {number} * /
var X = { ONE: 1, TWO: 2 };
the properties of the object literal are constant.
|
boolean |
enumLiteralHasKey(java.lang.String name) |
JSType |
getDeclaredProp(QualifiedName qname)
Get the declared type of the given property
|
JSType |
getEnumeratedType() |
JSType |
getProp(QualifiedName qname)
Get the inferred type of the given property
|
JSType |
getPropType() |
JSTypeExpression |
getTypeExpr() |
JSTypeExpression |
getTypeExprForErrorReporting() |
boolean |
hasConstantProp(QualifiedName qname)
Return whether this type contains a constant property
|
(package private) static boolean |
hasNonScalar(com.google.common.collect.ImmutableSet<EnumType> enums) |
boolean |
hasProp(QualifiedName qname)
Return whether this type contains a required property
|
(package private) static boolean |
hasScalar(com.google.common.collect.ImmutableSet<EnumType> enums) |
boolean |
isResolved() |
static EnumType |
make(java.lang.String name,
JSTypeExpression typeExpr,
java.util.Collection<java.lang.String> props) |
boolean |
mayHaveProp(QualifiedName qname)
Return whether this type contains any form of property
|
(package private) static com.google.common.collect.ImmutableSet<EnumType> |
normalizeForJoin(com.google.common.collect.ImmutableSet<EnumType> newEnums,
JSType joinWithoutEnums) |
(package private) void |
resolveEnum(JSType t) |
java.lang.String |
toString() |
(package private) static com.google.common.collect.ImmutableSet<EnumType> |
union(com.google.common.collect.ImmutableSet<EnumType> s1,
com.google.common.collect.ImmutableSet<EnumType> s2) |
addNamespace, addProperty, addTypedef, addUndeclaredProperty, copyWindowProperties, getAllPropsOfNamespace, getDeclaration, getName, getNsProp, getPropDeclaredType, getSubnamespace, hasProp, hasSubnamespace, isDefined, toJSTypeprivate EnumType.State state
private JSTypeExpression typeExpr
private JSType declaredType
private JSType enumPropType
private com.google.common.collect.ImmutableSet<java.lang.String> props
private EnumType(java.lang.String name,
JSTypeExpression typeExpr,
java.util.Collection<java.lang.String> props)
public static EnumType make(java.lang.String name, JSTypeExpression typeExpr, java.util.Collection<java.lang.String> props)
public boolean isResolved()
public JSType getEnumeratedType()
public JSType getPropType()
public JSTypeExpression getTypeExpr()
public JSTypeExpression getTypeExprForErrorReporting()
void resolveEnum(JSType t)
protected JSType computeJSType(JSTypes commonTypes)
computeJSType in class Namespacepublic JSType getProp(QualifiedName qname)
TypeWithPropertiesgetProp in interface TypeWithPropertiespublic JSType getDeclaredProp(QualifiedName qname)
TypeWithPropertiesgetDeclaredProp in interface TypeWithPropertiespublic boolean mayHaveProp(QualifiedName qname)
TypeWithPropertiesmayHaveProp in interface TypeWithPropertiespublic boolean hasProp(QualifiedName qname)
TypeWithPropertieshasProp in interface TypeWithPropertiespublic boolean hasConstantProp(QualifiedName qname)
TypeWithPropertieshasConstantProp in interface TypeWithPropertiespublic boolean enumLiteralHasKey(java.lang.String name)
static boolean hasScalar(com.google.common.collect.ImmutableSet<EnumType> enums)
static boolean hasNonScalar(com.google.common.collect.ImmutableSet<EnumType> enums)
static com.google.common.collect.ImmutableSet<EnumType> union(com.google.common.collect.ImmutableSet<EnumType> s1, com.google.common.collect.ImmutableSet<EnumType> s2)
static com.google.common.collect.ImmutableSet<EnumType> normalizeForJoin(com.google.common.collect.ImmutableSet<EnumType> newEnums, JSType joinWithoutEnums)
static boolean areSubtypes(JSType t1, JSType t2, SubtypeCache subSuperMap)