Environment class final
An environment containing variables.
An environment can belong to another enclosing environment, which will be considered when looking for a variable.
Constructors
- Environment.new({Environment? enclosing})
- Creates an environment.
Properties
- enclosing → Environment?
-
The enclosing environment.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
ancestor(
int distance) → Environment -
Gets the nᵗʰ ancestor environment, according to
distance
. -
assign(
Token name, Object? value) → void -
Sets the
value
forname
in the environment. -
assignAt(
int distance, Token name, Object? value) → void -
Sets
name
tovalue
in the nᵗʰ ancestor, according todistance
. -
define(
String name, Object? value) → void -
Defines a
name
in the environment with the passedvalue
. -
get(
Token name) → Object? -
Get a variable with the given
name
in the environment. -
getAt(
int distance, String name) → Object? -
Gets
name
in the nᵗʰ ancestor, according todistance
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited