Package com.google.javascript.rhino
Enum Class ClosurePrimitive
- All Implemented Interfaces:
Serializable
,Comparable<ClosurePrimitive>
,Constable
Enum of primitive functions that the compiler recognizes
These correspond to the @closurePrimitive tag in code; in order to parse new primitives, add any entry to the list in parsing/ParserConfig.properties, then map it to an enum member in the idToEnum map.
After typechecking is done, all calls to one of these primitive types should have their FunctionType annotated with the corresponding enum member. This is intended to make identifying these calls more accurate than previous methods of finding primitives by qualified name.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ClosurePrimitive
fromStringId
(@Nullable String id) Returns the ClosurePrimitive corresponding to the given string id.static ClosurePrimitive
Returns the enum constant of this class with the specified name.static ClosurePrimitive[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ASSERTS_FAIL
-
ASSERTS_MATCHES_RETURN
-
ASSERTS_TRUTHY
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromStringId
Returns the ClosurePrimitive corresponding to the given string id.This is to make reading
@closurePrimitive
easier in code. Using Enum.valueOf to parse closure primitive identifiers from JSDoc directly would require code likeclosurePrimitive {ASSERTS_FAIL}
; instead we separate the string ids from the enum names.- Parameters:
id
- a string id that normalized to an enum member, or null- Returns:
- null if the argument is null, otherwise the corresponding enum member
- Throws:
IllegalArgumentException
- if the id is non-null but does not match an enum member
-