Package net.hydromatic.morel.compile
Class TypeResolver.BindTypeEnv
java.lang.Object
net.hydromatic.morel.compile.TypeResolver.BindTypeEnv
- All Implemented Interfaces:
TypeResolver.TypeEnv
- Enclosing class:
TypeResolver
A type environment that consists of a type environment plus one binding.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Binding.Kindprivate final TypeResolver.TypeEnvprivate final Function<TypeSystem, Unifier.Term> -
Constructor Summary
ConstructorsConstructorDescriptionBindTypeEnv(String definedName, Binding.Kind kind, Function<TypeSystem, Unifier.Term> termFactory, TypeResolver.TypeEnv parent) -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectInstances(TypeSystem typeSystem, String name, Consumer<Unifier.Term> consumer) Collects terms that are instance ofname.intReturns the number of times a name is bound.get(TypeSystem typeSystem, String name, Function<String, RuntimeException> exceptionFactory) Returns a term for the variable with a given name, creating if necessary.private TypeResolver.TypeEnvReturns the nearest ancestor of this environment that is not aTypeResolver.BindTypeEnv.@Nullable TypegetTypeOpt(String name) Returns the datatype of a variable, or null if no type is known.booleanReturns whether a variable of the given name is defined in this environment.booleanhasOverloaded(String name) Returns whether a given name is overloaded in this environment.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.hydromatic.morel.compile.TypeResolver.TypeEnv
bind, bind, bind, getKind
-
Field Details
-
definedName
-
kind
-
termFactory
-
parent
-
-
Constructor Details
-
BindTypeEnv
BindTypeEnv(String definedName, Binding.Kind kind, Function<TypeSystem, Unifier.Term> termFactory, TypeResolver.TypeEnv parent)
-
-
Method Details
-
count
Description copied from interface:TypeResolver.TypeEnvReturns the number of times a name is bound.- Specified by:
countin interfaceTypeResolver.TypeEnv
-
get
public Unifier.Term get(TypeSystem typeSystem, String name, Function<String, RuntimeException> exceptionFactory) Description copied from interface:TypeResolver.TypeEnvReturns a term for the variable with a given name, creating if necessary.- Specified by:
getin interfaceTypeResolver.TypeEnv
-
getTypeOpt
Description copied from interface:TypeResolver.TypeEnvReturns the datatype of a variable, or null if no type is known.Generally, type is known for built-in values but not for values in this compilation unit.
- Specified by:
getTypeOptin interfaceTypeResolver.TypeEnv
-
getAncestor
Returns the nearest ancestor of this environment that is not aTypeResolver.BindTypeEnv. -
has
Description copied from interface:TypeResolver.TypeEnvReturns whether a variable of the given name is defined in this environment.- Specified by:
hasin interfaceTypeResolver.TypeEnv
-
hasOverloaded
Description copied from interface:TypeResolver.TypeEnvReturns whether a given name is overloaded in this environment.- Specified by:
hasOverloadedin interfaceTypeResolver.TypeEnv
-
collectInstances
Description copied from interface:TypeResolver.TypeEnvCollects terms that are instance ofname.- Specified by:
collectInstancesin interfaceTypeResolver.TypeEnv
-
toString
-