Package net.hydromatic.morel.compile
Class Environments.EmptyEnvironment
- java.lang.Object
-
- net.hydromatic.morel.compile.Environment
-
- net.hydromatic.morel.compile.Environments.EmptyEnvironment
-
- Enclosing class:
- Environments
private static class Environments.EmptyEnvironment extends Environment
Empty environment.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static Environments.EmptyEnvironmentINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateEmptyEnvironment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intdistance(int soFar, Core.NamedPat id)@Nullable BindinggetOpt(String name)Returns the binding ofnameif bound, null if not.@Nullable BindinggetOpt(Core.NamedPat id)Returns the binding ofidif bound, null if not.(package private) EnvironmentnearestAncestorNotObscuredBy(Set<Core.NamedPat> names)If this environment only defines bindings in the given set, returns its parent.(package private) voidvisit(Consumer<Binding> consumer)Visits every variable binding in this environment.-
Methods inherited from class net.hydromatic.morel.compile.Environment
asString, bind, bind, bindAll, forEachType, forEachValue, getValueMap, plus
-
-
-
-
Field Detail
-
INSTANCE
static final Environments.EmptyEnvironment INSTANCE
-
-
Method Detail
-
visit
void visit(Consumer<Binding> consumer)
Description copied from class:EnvironmentVisits every variable binding in this environment.Bindings that are obscured by more recent bindings of the same name are visited, but after the more obscuring bindings.
- Specified by:
visitin classEnvironment
-
getOpt
public @Nullable Binding getOpt(String name)
Description copied from class:EnvironmentReturns the binding ofnameif bound, null if not.- Specified by:
getOptin classEnvironment
-
getOpt
public @Nullable Binding getOpt(Core.NamedPat id)
Description copied from class:EnvironmentReturns the binding ofidif bound, null if not.- Specified by:
getOptin classEnvironment
-
nearestAncestorNotObscuredBy
Environment nearestAncestorNotObscuredBy(Set<Core.NamedPat> names)
Description copied from class:EnvironmentIf this environment only defines bindings in the given set, returns its parent. Never returns null. The empty environment returns itself.- Specified by:
nearestAncestorNotObscuredByin classEnvironment
-
distance
int distance(int soFar, Core.NamedPat id)- Specified by:
distancein classEnvironment
-
-