public class UnionTypeBuilder
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.util.List<JSType> |
alternates |
private boolean |
areAllUnknownsChecked |
private boolean |
containsVoidType |
private static int |
DEFAULT_MAX_UNION_SIZE |
private int |
functionTypePosition |
private boolean |
isAllType |
private boolean |
isNativeUnknownType |
private int |
maxUnionSize |
private JSTypeRegistry |
registry |
private JSType |
result |
private static long |
serialVersionUID |
Constructor and Description |
---|
UnionTypeBuilder(JSTypeRegistry registry) |
UnionTypeBuilder(JSTypeRegistry registry,
int maxUnionSize) |
Modifier and Type | Method and Description |
---|---|
UnionTypeBuilder |
addAlternate(JSType alternate)
Adds an alternate to the union type under construction.
|
UnionTypeBuilder |
addAlternate(JSType alternate,
boolean isStructural)
Adds an alternate to the union type under construction.
|
JSType |
build()
Creates a union.
|
(package private) java.util.Collection<JSType> |
getAlternates() |
private JSType |
getNativeWildcardType()
Returns ALL_TYPE, UNKNOWN_TYPE, or CHECKED_UNKNOWN_TYPE, as specified by the flags, or null
|
private boolean |
isSubtype(JSType rightType,
JSType leftType,
boolean isStructural) |
private JSType |
reduceAlternatesWithoutUnion()
Reduce the alternates into a non-union type.
|
private static final long serialVersionUID
private static final int DEFAULT_MAX_UNION_SIZE
private final JSTypeRegistry registry
private final java.util.List<JSType> alternates
private boolean containsVoidType
private boolean isAllType
private boolean isNativeUnknownType
private boolean areAllUnknownsChecked
private final int maxUnionSize
private int functionTypePosition
private JSType result
public UnionTypeBuilder(JSTypeRegistry registry)
UnionTypeBuilder(JSTypeRegistry registry, int maxUnionSize)
java.util.Collection<JSType> getAlternates()
public UnionTypeBuilder addAlternate(JSType alternate, boolean isStructural)
public UnionTypeBuilder addAlternate(JSType alternate)
private JSType reduceAlternatesWithoutUnion()
private JSType getNativeWildcardType()
public JSType build()
NO_TYPE
.