Package com.google.javascript.jscomp
Class CodingConvention.AssertionFunctionSpec
- java.lang.Object
-
- com.google.javascript.jscomp.CodingConvention.AssertionFunctionSpec
-
- Direct Known Subclasses:
ClosureCodingConvention.AssertInstanceofSpec
- Enclosing interface:
- CodingConvention
public static class CodingConvention.AssertionFunctionSpec extends java.lang.ObjectA function that will throw an exception when either: -One or more of its parameters evaluate to false. -One or more of its parameters are not of a certain type.
-
-
Field Summary
Fields Modifier and Type Field Description protected JSTypeNativeassertedTypeprotected java.lang.StringfunctionName
-
Constructor Summary
Constructors Constructor Description AssertionFunctionSpec(java.lang.String functionName)AssertionFunctionSpec(java.lang.String functionName, JSTypeNative assertedType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodegetAssertedParam(Node firstParam)Returns the parameter of the assertion function that is being checked.JSTypegetAssertedType(Node call, JSTypeRegistry registry)Returns the type for a type assertion, or null if the function asserts that the node must not be null or undefined.java.lang.StringgetFunctionName()Returns the name of the function.
-
-
-
Field Detail
-
functionName
protected final java.lang.String functionName
-
assertedType
protected final JSTypeNative assertedType
-
-
Constructor Detail
-
AssertionFunctionSpec
public AssertionFunctionSpec(java.lang.String functionName)
-
AssertionFunctionSpec
public AssertionFunctionSpec(java.lang.String functionName, JSTypeNative assertedType)
-
-
Method Detail
-
getFunctionName
public java.lang.String getFunctionName()
Returns the name of the function.
-
getAssertedParam
public Node getAssertedParam(Node firstParam)
Returns the parameter of the assertion function that is being checked.- Parameters:
firstParam- The first parameter of the function call.
-
getAssertedType
public JSType getAssertedType(Node call, JSTypeRegistry registry)
Returns the type for a type assertion, or null if the function asserts that the node must not be null or undefined.- Parameters:
call- The asserting call
-
-