public final class FunctionType
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static FunctionType |
BOTTOM_FUNCTION |
private static boolean |
DEBUGGING |
private boolean |
isLoose |
private static FunctionType |
LOOSE_TOP_FUNCTION |
private JSType |
nominalType |
private com.google.common.collect.ImmutableList<JSType> |
optionalFormals |
private com.google.common.collect.ImmutableMap<java.lang.String,JSType> |
outerVarPreconditions |
(package private) static FunctionType |
QMARK_FUNCTION |
private JSType |
receiverType |
private com.google.common.collect.ImmutableList<JSType> |
requiredFormals |
private JSType |
restFormals |
private JSType |
returnType |
(package private) static FunctionType |
TOP_FUNCTION |
private com.google.common.collect.ImmutableList<java.lang.String> |
typeParameters |
Modifier | Constructor and Description |
---|---|
private |
FunctionType(boolean isLoose) |
private |
FunctionType(com.google.common.collect.ImmutableList<JSType> requiredFormals,
com.google.common.collect.ImmutableList<JSType> optionalFormals,
JSType restFormals,
JSType retType,
JSType nominalType,
JSType receiverType,
com.google.common.collect.ImmutableMap<java.lang.String,JSType> outerVars,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters,
boolean isLoose) |
Modifier and Type | Method and Description |
---|---|
private boolean |
acceptsAnyArguments() |
java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder) |
(package private) void |
checkValid() |
boolean |
equals(java.lang.Object obj) |
private JSType |
fromReceiverToFirstFormal() |
JSType |
getFormalType(int argpos) |
JSType |
getInstanceTypeOfCtor() |
int |
getMaxArity() |
int |
getMaxArityWithoutRestFormals() |
int |
getMinArity() |
private static NominalType |
getNominalTypeIfSingletonObj(JSType t) |
JSType |
getOuterVarPrecondition(java.lang.String name) |
JSType |
getRestFormalsType() |
JSType |
getReturnType() |
JSType |
getSuperPrototype() |
JSType |
getThisType() |
java.util.List<java.lang.String> |
getTypeParameters() |
int |
hashCode() |
boolean |
hasRestFormals() |
FunctionType |
instantiateGenerics(java.util.Map<java.lang.String,JSType> typeMap) |
FunctionType |
instantiateGenericsFromArgumentTypes(java.util.List<JSType> argTypes) |
private static FunctionType |
instantiateGenericsWithUnknown(FunctionType f) |
boolean |
isGeneric() |
(package private) static boolean |
isInhabitable(FunctionType f) |
boolean |
isInterfaceDefinition() |
boolean |
isLoose() |
(package private) boolean |
isLooseSubtypeOf(FunctionType f2,
SubtypeCache subSuperMap) |
boolean |
isOptionalArg(int i) |
boolean |
isQmarkFunction() |
boolean |
isRequiredArg(int i) |
boolean |
isSomeConstructorOrInterface() |
(package private) boolean |
isSubtypeOf(FunctionType other,
SubtypeCache subSuperMap) |
private boolean |
isSubtypeOfHelper(FunctionType other,
boolean checkThisType,
SubtypeCache subSuperMap) |
boolean |
isTopFunction() |
boolean |
isUniqueConstructor() |
boolean |
isValidOverride(FunctionType other) |
(package private) static FunctionType |
join(FunctionType f1,
FunctionType f2) |
private static JSType |
joinNominalTypes(JSType nt1,
JSType nt2) |
private static FunctionType |
looseJoin(FunctionType f1,
FunctionType f2) |
(package private) static FunctionType |
meet(FunctionType f1,
FunctionType f2) |
private static JSType |
meetNominalTypes(JSType nt1,
JSType nt2) |
(package private) static FunctionType |
normalized(java.util.List<JSType> requiredFormals,
java.util.List<JSType> optionalFormals,
JSType restFormals,
JSType retType,
JSType nominalType,
JSType receiverType,
java.util.Map<java.lang.String,JSType> outerVars,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters,
boolean isLoose) |
private static JSType |
nullAcceptingMeet(JSType t1,
JSType t2) |
(package private) FunctionType |
specialize(FunctionType other) |
private static JSType |
substGenericsInNomType(JSType nt,
java.util.Map<java.lang.String,JSType> typeMap) |
(package private) FunctionType |
substituteGenerics(java.util.Map<java.lang.String,JSType> concreteTypes)
FunctionType#substituteGenerics is called while instantiating prototype
methods of generic nominal types.
|
private FunctionType |
substituteNominalGenerics(java.util.Map<java.lang.String,JSType> typeMap) |
private FunctionType |
substituteParametricGenerics(java.util.Map<java.lang.String,JSType> typeMap) |
DeclaredFunctionType |
toDeclaredFunctionType() |
java.lang.String |
toString() |
FunctionType |
transformByApplyProperty(JSTypes commonTypes) |
FunctionType |
transformByCallProperty() |
(package private) static FunctionType |
unifyUnknowns(FunctionType f1,
FunctionType f2)
Unify the two types symmetrically, given that we have already instantiated
the type variables of interest in
f1 and f2 , treating
JSType.UNKNOWN as a "hole" to be filled. |
(package private) boolean |
unifyWithSubtype(FunctionType other,
java.util.List<java.lang.String> typeParameters,
com.google.common.collect.Multimap<java.lang.String,JSType> typeMultimap,
SubtypeCache subSuperMap) |
(package private) FunctionType |
withLoose() |
private final com.google.common.collect.ImmutableList<JSType> requiredFormals
private final com.google.common.collect.ImmutableList<JSType> optionalFormals
private final JSType restFormals
private final JSType returnType
private final boolean isLoose
private final com.google.common.collect.ImmutableMap<java.lang.String,JSType> outerVarPreconditions
private final JSType nominalType
private final JSType receiverType
private final com.google.common.collect.ImmutableList<java.lang.String> typeParameters
private static final boolean DEBUGGING
static final FunctionType TOP_FUNCTION
private static final FunctionType LOOSE_TOP_FUNCTION
static final FunctionType QMARK_FUNCTION
private static final FunctionType BOTTOM_FUNCTION
private FunctionType(com.google.common.collect.ImmutableList<JSType> requiredFormals, com.google.common.collect.ImmutableList<JSType> optionalFormals, JSType restFormals, JSType retType, JSType nominalType, JSType receiverType, com.google.common.collect.ImmutableMap<java.lang.String,JSType> outerVars, com.google.common.collect.ImmutableList<java.lang.String> typeParameters, boolean isLoose)
private FunctionType(boolean isLoose)
void checkValid()
public boolean isLoose()
FunctionType withLoose()
static FunctionType normalized(java.util.List<JSType> requiredFormals, java.util.List<JSType> optionalFormals, JSType restFormals, JSType retType, JSType nominalType, JSType receiverType, java.util.Map<java.lang.String,JSType> outerVars, com.google.common.collect.ImmutableList<java.lang.String> typeParameters, boolean isLoose)
public boolean isTopFunction()
private static NominalType getNominalTypeIfSingletonObj(JSType t)
public boolean isSomeConstructorOrInterface()
public boolean isUniqueConstructor()
public boolean isInterfaceDefinition()
public JSType getSuperPrototype()
public boolean isQmarkFunction()
static boolean isInhabitable(FunctionType f)
public boolean hasRestFormals()
public JSType getRestFormalsType()
public JSType getFormalType(int argpos)
public JSType getReturnType()
public JSType getOuterVarPrecondition(java.lang.String name)
public int getMinArity()
public int getMaxArity()
public int getMaxArityWithoutRestFormals()
public boolean isRequiredArg(int i)
public boolean isOptionalArg(int i)
public JSType getInstanceTypeOfCtor()
public JSType getThisType()
public FunctionType transformByCallProperty()
public FunctionType transformByApplyProperty(JSTypes commonTypes)
private JSType fromReceiverToFirstFormal()
public DeclaredFunctionType toDeclaredFunctionType()
private static FunctionType looseJoin(FunctionType f1, FunctionType f2)
public boolean isValidOverride(FunctionType other)
boolean isSubtypeOf(FunctionType other, SubtypeCache subSuperMap)
private boolean acceptsAnyArguments()
private boolean isSubtypeOfHelper(FunctionType other, boolean checkThisType, SubtypeCache subSuperMap)
static FunctionType join(FunctionType f1, FunctionType f2)
FunctionType specialize(FunctionType other)
static FunctionType meet(FunctionType f1, FunctionType f2)
boolean isLooseSubtypeOf(FunctionType f2, SubtypeCache subSuperMap)
public boolean isGeneric()
public java.util.List<java.lang.String> getTypeParameters()
boolean unifyWithSubtype(FunctionType other, java.util.List<java.lang.String> typeParameters, com.google.common.collect.Multimap<java.lang.String,JSType> typeMultimap, SubtypeCache subSuperMap)
private static FunctionType instantiateGenericsWithUnknown(FunctionType f)
static FunctionType unifyUnknowns(FunctionType f1, FunctionType f2)
f1
and f2
, treating
JSType.UNKNOWN as a "hole" to be filled.private static JSType substGenericsInNomType(JSType nt, java.util.Map<java.lang.String,JSType> typeMap)
private FunctionType substituteNominalGenerics(java.util.Map<java.lang.String,JSType> typeMap)
private FunctionType substituteParametricGenerics(java.util.Map<java.lang.String,JSType> typeMap)
FunctionType substituteGenerics(java.util.Map<java.lang.String,JSType> concreteTypes)
public FunctionType instantiateGenerics(java.util.Map<java.lang.String,JSType> typeMap)
public FunctionType instantiateGenericsFromArgumentTypes(java.util.List<JSType> argTypes)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder)