public final class FunctionTypeBuilder
extends java.lang.Object
FunctionType
and DeclaredFunctionType
.
The builder is called during both JSDoc parsing and type inference, and
these parts use different warning systems, so expect the context to handle
the exception appropriately.Modifier and Type | Class and Description |
---|---|
(package private) static class |
FunctionTypeBuilder.WrongParameterOrderException |
Modifier and Type | Field and Description |
---|---|
private boolean |
loose |
private JSType |
nominalType |
private java.util.List<JSType> |
optionalFormals |
private java.util.Map<java.lang.String,JSType> |
outerVars |
private JSType |
receiverType |
private java.util.List<JSType> |
requiredFormals |
private JSType |
restFormals |
private JSType |
returnType |
private com.google.common.collect.ImmutableList<java.lang.String> |
typeParameters |
Constructor and Description |
---|
FunctionTypeBuilder() |
Modifier and Type | Method and Description |
---|---|
FunctionTypeBuilder |
addLoose() |
FunctionTypeBuilder |
addNominalType(JSType t) |
FunctionTypeBuilder |
addOptFormal(JSType t) |
FunctionTypeBuilder |
addOuterVarPrecondition(java.lang.String name,
JSType t) |
FunctionTypeBuilder |
addPlaceholderFormal()
Used when the order of required/optional/rest formals in a function jsdoc is wrong.
|
FunctionTypeBuilder |
addReceiverType(JSType t) |
FunctionTypeBuilder |
addReqFormal(JSType t) |
FunctionTypeBuilder |
addRestFormals(JSType t) |
FunctionTypeBuilder |
addRetType(JSType t) |
FunctionTypeBuilder |
addTypeParameters(com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
DeclaredFunctionType |
buildDeclaration() |
FunctionType |
buildFunction() |
(package private) static FunctionTypeBuilder |
qmarkFunctionBuilder() |
private final java.util.List<JSType> requiredFormals
private final java.util.List<JSType> optionalFormals
private final java.util.Map<java.lang.String,JSType> outerVars
private JSType restFormals
private JSType returnType
private boolean loose
private JSType nominalType
private JSType receiverType
private com.google.common.collect.ImmutableList<java.lang.String> typeParameters
static FunctionTypeBuilder qmarkFunctionBuilder()
public FunctionTypeBuilder addPlaceholderFormal()
public FunctionTypeBuilder addReqFormal(JSType t) throws FunctionTypeBuilder.WrongParameterOrderException
public FunctionTypeBuilder addOptFormal(JSType t) throws FunctionTypeBuilder.WrongParameterOrderException
public FunctionTypeBuilder addOuterVarPrecondition(java.lang.String name, JSType t)
public FunctionTypeBuilder addRestFormals(JSType t)
public FunctionTypeBuilder addRetType(JSType t)
public FunctionTypeBuilder addLoose()
public FunctionTypeBuilder addNominalType(JSType t)
public FunctionTypeBuilder addTypeParameters(com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public FunctionTypeBuilder addReceiverType(JSType t)
public DeclaredFunctionType buildDeclaration()
public FunctionType buildFunction()