Class TemplateTypeReplacer
- java.lang.Object
-
- com.google.javascript.rhino.jstype.TemplateTypeReplacer
-
public final class TemplateTypeReplacer extends java.lang.Object implements Visitor<JSType>
SpecializesTemplatizedType
s according to provided bindings.- Author:
- [email protected] (John Lenz)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.javascript.rhino.jstype.Visitor
Visitor.WithDefaultCase<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JSType
caseAllType()
All type's case.JSType
caseBigIntType()
BigInt value type's case.JSType
caseBooleanType()
Boolean value type's case.JSType
caseEnumElementType(EnumElementType type)
Enum element type's case.JSType
caseFunctionType(FunctionType type)
Function type's case.JSType
caseNamedType(NamedType type)
Named type's case.JSType
caseNoObjectType()
Bottom Object type's case.JSType
caseNoType(NoType type)
Bottom type's case.JSType
caseNullType()
Null type's case.JSType
caseNumberType()
Number value type's case.JSType
caseObjectType(ObjectType objType)
Object type's case.JSType
caseProxyObjectType(ProxyObjectType type)
Proxy type's case.JSType
caseStringType()
String value type's case.JSType
caseSymbolType()
Symbol value type's case.JSType
caseTemplateType(TemplateType type)
Template type's case.JSType
caseTemplatizedType(TemplatizedType type)
Templatized type's case.JSType
caseUnionType(UnionType type)
Union type's case.JSType
caseUnknownType()
Unknown type's case.JSType
caseVoidType()
Void type's case.static TemplateTypeReplacer
forInference(JSTypeRegistry registry, java.util.Map<TemplateType,JSType> bindings)
Creates a replacer for use duringTypeInference
.static TemplateTypeReplacer
forPartialReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)
Creates a replacer that may not totally eliminateTemplateType
s from the definitions of the types it performs replacement on.static TemplateTypeReplacer
forTotalReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)
Creates a replacer that will always totally eliminateTemplateType
s from the definitions of the types it performs replacement on.boolean
hasMadeReplacement()
-
-
-
Method Detail
-
forInference
public static TemplateTypeReplacer forInference(JSTypeRegistry registry, java.util.Map<TemplateType,JSType> bindings)
Creates a replacer for use duringTypeInference
.
-
forTotalReplacement
public static TemplateTypeReplacer forTotalReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)
Creates a replacer that will always totally eliminateTemplateType
s from the definitions of the types it performs replacement on.If a binding for a
TemplateType
is required but not provided, `?` will be used.
-
forPartialReplacement
public static TemplateTypeReplacer forPartialReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)
Creates a replacer that may not totally eliminateTemplateType
s from the definitions of the types it performs replacement on.If a binding for a
TemplateType
is required but not provided, uses of that type will not be replaced.
-
hasMadeReplacement
public boolean hasMadeReplacement()
-
caseNoType
public JSType caseNoType(NoType type)
Description copied from interface:Visitor
Bottom type's case.- Specified by:
caseNoType
in interfaceVisitor<JSType>
-
caseEnumElementType
public JSType caseEnumElementType(EnumElementType type)
Description copied from interface:Visitor
Enum element type's case.- Specified by:
caseEnumElementType
in interfaceVisitor<JSType>
-
caseAllType
public JSType caseAllType()
Description copied from interface:Visitor
All type's case.- Specified by:
caseAllType
in interfaceVisitor<JSType>
-
caseBooleanType
public JSType caseBooleanType()
Description copied from interface:Visitor
Boolean value type's case.- Specified by:
caseBooleanType
in interfaceVisitor<JSType>
-
caseNoObjectType
public JSType caseNoObjectType()
Description copied from interface:Visitor
Bottom Object type's case.- Specified by:
caseNoObjectType
in interfaceVisitor<JSType>
-
caseFunctionType
public JSType caseFunctionType(FunctionType type)
Description copied from interface:Visitor
Function type's case.- Specified by:
caseFunctionType
in interfaceVisitor<JSType>
-
caseObjectType
public JSType caseObjectType(ObjectType objType)
Description copied from interface:Visitor
Object type's case.- Specified by:
caseObjectType
in interfaceVisitor<JSType>
-
caseTemplatizedType
public JSType caseTemplatizedType(TemplatizedType type)
Description copied from interface:Visitor
Templatized type's case.- Specified by:
caseTemplatizedType
in interfaceVisitor<JSType>
-
caseUnknownType
public JSType caseUnknownType()
Description copied from interface:Visitor
Unknown type's case.- Specified by:
caseUnknownType
in interfaceVisitor<JSType>
-
caseNullType
public JSType caseNullType()
Description copied from interface:Visitor
Null type's case.- Specified by:
caseNullType
in interfaceVisitor<JSType>
-
caseNumberType
public JSType caseNumberType()
Description copied from interface:Visitor
Number value type's case.- Specified by:
caseNumberType
in interfaceVisitor<JSType>
-
caseBigIntType
public JSType caseBigIntType()
Description copied from interface:Visitor
BigInt value type's case.- Specified by:
caseBigIntType
in interfaceVisitor<JSType>
-
caseStringType
public JSType caseStringType()
Description copied from interface:Visitor
String value type's case.- Specified by:
caseStringType
in interfaceVisitor<JSType>
-
caseSymbolType
public JSType caseSymbolType()
Description copied from interface:Visitor
Symbol value type's case.- Specified by:
caseSymbolType
in interfaceVisitor<JSType>
-
caseVoidType
public JSType caseVoidType()
Description copied from interface:Visitor
Void type's case.- Specified by:
caseVoidType
in interfaceVisitor<JSType>
-
caseUnionType
public JSType caseUnionType(UnionType type)
Description copied from interface:Visitor
Union type's case.- Specified by:
caseUnionType
in interfaceVisitor<JSType>
-
caseTemplateType
public JSType caseTemplateType(TemplateType type)
Description copied from interface:Visitor
Template type's case.- Specified by:
caseTemplateType
in interfaceVisitor<JSType>
-
caseNamedType
public JSType caseNamedType(NamedType type)
Description copied from interface:Visitor
Named type's case.- Specified by:
caseNamedType
in interfaceVisitor<JSType>
-
caseProxyObjectType
public JSType caseProxyObjectType(ProxyObjectType type)
Description copied from interface:Visitor
Proxy type's case.- Specified by:
caseProxyObjectType
in interfaceVisitor<JSType>
-
-