Package com.google.javascript.rhino
Class JSTypeExpression
java.lang.Object
com.google.javascript.rhino.JSTypeExpression
- All Implemented Interfaces:
Serializable
When parsing a jsdoc, a type-annotation string is parsed to a type AST. Somewhat confusingly, we
use the Node class both for type ASTs and for the source-code AST. JSTypeExpression wraps a type
AST. During type checking, type ASTs are evaluated to JavaScript types.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()evaluate(@Nullable StaticTypedScope scope, JSTypeRegistry registry) Evaluates the type expression into aJSTypeobject.com.google.common.collect.ImmutableSet<String> Returns a set of all string names in this type expressioncom.google.common.collect.ImmutableList<Node> Returns a list of all type nodes in this type expression.com.google.common.collect.ImmutableSet<String> Returns a set of keys of all record types (e.g.getRoot()booleanisEquivalentTo(@Nullable JSTypeExpression other) Does this object represent a type expression that is equivalent to the other one?booleanWhether this expression is an explicit unknown template bound.booleanDoes this expression denote an optional@param?booleanDoes this expression denote a rest args@param?static JSTypeExpressionMake the given type expression into an optional type expression, if possible.replaceNamesWithUnknownType(Set<String> names) Replaces given names in this type expression with unknowntoString()
-
Constructor Details
-
JSTypeExpression
-
-
Method Details
-
replaceNamesWithUnknownType
Replaces given names in this type expression with unknown -
getAllTypeNodes
Returns a list of all type nodes in this type expression. -
getAllTypeNames
Returns a set of all string names in this type expression -
makeOptionalArg
Make the given type expression into an optional type expression, if possible. -
isOptionalArg
public boolean isOptionalArg()Does this expression denote an optional@param? -
isVarArgs
public boolean isVarArgs()Does this expression denote a rest args@param? -
evaluate
Evaluates the type expression into aJSTypeobject. -
isEquivalentTo
Does this object represent a type expression that is equivalent to the other one? -
getRoot
- Returns:
- The source for this type expression. Note that it will not contain an expression if there's an @override tag.
-
getSourceName
-
toString
-
copy
-
isExplicitUnknownTemplateBound
public boolean isExplicitUnknownTemplateBound()Whether this expression is an explicit unknown template bound. -
getRecordPropertyNames
Returns a set of keys of all record types (e.g. {{key : string }}) present in this JSTypeExpression.
-