Package net.hydromatic.morel.compile
Interface TypeResolver.TypeEnv
- All Known Implementing Classes:
TypeResolver.BindTypeEnv,TypeResolver.EmptyTypeEnv,TypeResolver.EnvironmentTypeEnv
- Enclosing class:
TypeResolver
static interface TypeResolver.TypeEnv
Type environment.
-
Method Summary
Modifier and TypeMethodDescriptiondefault TypeResolver.TypeEnvbind(String name, Binding.Kind kind, Function<TypeSystem, Unifier.Term> termFactory) default TypeResolver.TypeEnvbind(String name, Binding.Kind kind, Unifier.Term term) default TypeResolver.TypeEnvbind(String name, Unifier.Term term) default voidcollectInstances(TypeSystem typeSystem, String name, Consumer<Unifier.Term> consumer) Collects terms that are instance ofname.default 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.default Binding.KindgetKind(String name, Unifier.Term term) @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.default booleanhasOverloaded(String name) Returns whether a given name is overloaded in this environment.static Function<String, RuntimeException> onlyValidInQuery(AstNode node) Exception factory where a missing symbol is because we are not in a query.static Function<String, RuntimeException> Exception factory where a missing symbol is an internal error.static Function<String, RuntimeException> Exception factory where a missing symbol is a user error.
-
Method Details
-
get
Unifier.Term get(TypeSystem typeSystem, String name, Function<String, RuntimeException> exceptionFactory) Returns a term for the variable with a given name, creating if necessary. -
getTypeOpt
Returns 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.
-
count
Returns the number of times a name is bound. -
collectInstances
Collects terms that are instance ofname. -
has
Returns whether a variable of the given name is defined in this environment. -
hasOverloaded
Returns whether a given name is overloaded in this environment. -
bind
default TypeResolver.TypeEnv bind(String name, Binding.Kind kind, Function<TypeSystem, Unifier.Term> termFactory) -
bind
-
bind
-
getKind
-
oops
Exception factory where a missing symbol is an internal error. -
onlyValidInQuery
Exception factory where a missing symbol is because we are not in a query. -
unbound
Exception factory where a missing symbol is a user error.
-