Package com.google.javascript.rhino
Class JSTypeExpression
- java.lang.Object
-
- com.google.javascript.rhino.JSTypeExpression
-
- All Implemented Interfaces:
java.io.Serializable
public final class JSTypeExpression extends java.lang.Object implements java.io.Serializable
Represents a type expression as a miniature Rhino AST, so that the type expression can be evaluated later.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JSTypeExpression(Node root, java.lang.String sourceName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
JSType
evaluate(StaticScope<JSType> scope, JSTypeRegistry registry)
Evaluates the type expression into aJSType
object.Node
getRoot()
int
hashCode()
boolean
isOptionalArg()
boolean
isVarArgs()
static JSTypeExpression
makeOptionalArg(JSTypeExpression expr)
Make the given type expression into an optional type expression, if possible.
-
-
-
Constructor Detail
-
JSTypeExpression
public JSTypeExpression(Node root, java.lang.String sourceName)
-
-
Method Detail
-
makeOptionalArg
public static JSTypeExpression makeOptionalArg(JSTypeExpression expr)
Make the given type expression into an optional type expression, if possible.
-
isOptionalArg
public boolean isOptionalArg()
- Returns:
- Whether this expression denotes an optional
@param
.
-
isVarArgs
public boolean isVarArgs()
- Returns:
- Whether this expression denotes a rest args
@param
.
-
evaluate
public JSType evaluate(StaticScope<JSType> scope, JSTypeRegistry registry)
Evaluates the type expression into aJSType
object.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getRoot
public Node getRoot()
- Returns:
- The source for this type expression. Note that it will not contain an expression if there's an @override tag.
-
-