Class TemplateTypeReplacer
- java.lang.Object
-
- com.google.javascript.rhino.jstype.TemplateTypeReplacer
-
public final class TemplateTypeReplacer extends java.lang.Object implements Visitor<JSType>
SpecializesTemplatizedTypes according to provided bindings.
-
-
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 JSTypecaseAllType()All type's case.JSTypecaseBigIntType()BigInt value type's case.JSTypecaseBooleanType()Boolean value type's case.JSTypecaseEnumElementType(EnumElementType type)Enum element type's case.JSTypecaseFunctionType(FunctionType type)Function type's case.JSTypecaseNamedType(NamedType type)Named type's case.JSTypecaseNoObjectType()Bottom Object type's case.JSTypecaseNoType(NoType type)Bottom type's case.JSTypecaseNullType()Null type's case.JSTypecaseNumberType()Number value type's case.JSTypecaseObjectType(ObjectType objType)Object type's case.JSTypecaseProxyObjectType(ProxyObjectType type)Proxy type's case.JSTypecaseStringType()String value type's case.JSTypecaseSymbolType()Symbol value type's case.JSTypecaseTemplateType(TemplateType type)Template type's case.JSTypecaseTemplatizedType(TemplatizedType type)Templatized type's case.JSTypecaseUnionType(UnionType type)Union type's case.JSTypecaseUnknownType()Unknown type's case.JSTypecaseVoidType()Void type's case.static TemplateTypeReplacerforInference(JSTypeRegistry registry, java.util.Map<TemplateType,JSType> bindings)Creates a replacer for use duringTypeInference.static TemplateTypeReplacerforPartialReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)Creates a replacer that may not totally eliminateTemplateTypes from the definitions of the types it performs replacement on.static TemplateTypeReplacerforTotalReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)Creates a replacer that will always totally eliminateTemplateTypes from the definitions of the types it performs replacement on.booleanhasMadeReplacement()
-
-
-
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 eliminateTemplateTypes from the definitions of the types it performs replacement on.If a binding for a
TemplateTypeis required but not provided, `?` will be used.
-
forPartialReplacement
public static TemplateTypeReplacer forPartialReplacement(JSTypeRegistry registry, TemplateTypeMap bindings)
Creates a replacer that may not totally eliminateTemplateTypes from the definitions of the types it performs replacement on.If a binding for a
TemplateTypeis 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:VisitorBottom type's case.- Specified by:
caseNoTypein interfaceVisitor<JSType>
-
caseEnumElementType
public JSType caseEnumElementType(EnumElementType type)
Description copied from interface:VisitorEnum element type's case.- Specified by:
caseEnumElementTypein interfaceVisitor<JSType>
-
caseAllType
public JSType caseAllType()
Description copied from interface:VisitorAll type's case.- Specified by:
caseAllTypein interfaceVisitor<JSType>
-
caseBooleanType
public JSType caseBooleanType()
Description copied from interface:VisitorBoolean value type's case.- Specified by:
caseBooleanTypein interfaceVisitor<JSType>
-
caseNoObjectType
public JSType caseNoObjectType()
Description copied from interface:VisitorBottom Object type's case.- Specified by:
caseNoObjectTypein interfaceVisitor<JSType>
-
caseFunctionType
public JSType caseFunctionType(FunctionType type)
Description copied from interface:VisitorFunction type's case.- Specified by:
caseFunctionTypein interfaceVisitor<JSType>
-
caseObjectType
public JSType caseObjectType(ObjectType objType)
Description copied from interface:VisitorObject type's case.- Specified by:
caseObjectTypein interfaceVisitor<JSType>
-
caseTemplatizedType
public JSType caseTemplatizedType(TemplatizedType type)
Description copied from interface:VisitorTemplatized type's case.- Specified by:
caseTemplatizedTypein interfaceVisitor<JSType>
-
caseUnknownType
public JSType caseUnknownType()
Description copied from interface:VisitorUnknown type's case.- Specified by:
caseUnknownTypein interfaceVisitor<JSType>
-
caseNullType
public JSType caseNullType()
Description copied from interface:VisitorNull type's case.- Specified by:
caseNullTypein interfaceVisitor<JSType>
-
caseNumberType
public JSType caseNumberType()
Description copied from interface:VisitorNumber value type's case.- Specified by:
caseNumberTypein interfaceVisitor<JSType>
-
caseBigIntType
public JSType caseBigIntType()
Description copied from interface:VisitorBigInt value type's case.- Specified by:
caseBigIntTypein interfaceVisitor<JSType>
-
caseStringType
public JSType caseStringType()
Description copied from interface:VisitorString value type's case.- Specified by:
caseStringTypein interfaceVisitor<JSType>
-
caseSymbolType
public JSType caseSymbolType()
Description copied from interface:VisitorSymbol value type's case.- Specified by:
caseSymbolTypein interfaceVisitor<JSType>
-
caseVoidType
public JSType caseVoidType()
Description copied from interface:VisitorVoid type's case.- Specified by:
caseVoidTypein interfaceVisitor<JSType>
-
caseUnionType
public JSType caseUnionType(UnionType type)
Description copied from interface:VisitorUnion type's case.- Specified by:
caseUnionTypein interfaceVisitor<JSType>
-
caseTemplateType
public JSType caseTemplateType(TemplateType type)
Description copied from interface:VisitorTemplate type's case.- Specified by:
caseTemplateTypein interfaceVisitor<JSType>
-
caseNamedType
public JSType caseNamedType(NamedType type)
Description copied from interface:VisitorNamed type's case.- Specified by:
caseNamedTypein interfaceVisitor<JSType>
-
caseProxyObjectType
public JSType caseProxyObjectType(ProxyObjectType type)
Description copied from interface:VisitorProxy type's case.- Specified by:
caseProxyObjectTypein interfaceVisitor<JSType>
-
-