DartBlockEnvironment class
Models the scope of variables by storing the values for each variable name in a simple Map.
Constructors
-
DartBlockEnvironment(int key, {DartBlockEnvironment? parent, required List<
DartBlockEnvironment> children})
Properties
-
children
→ List<
DartBlockEnvironment> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → int
-
If indicated, the parent property provides the link to the parent Environment
which contains this Environment. This models for example the nesting of
code blocks, where for example variables declared in a for-loop should not
be accessible after exiting the loop.
The highest-up Environment (scope) has its parent property set to null,
thus indicating it is the "global" scope.
final
- parent → DartBlockEnvironment?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addChild(
DartBlockEnvironment child) → void -
assignValueToVariable(
DartBlockArbiter arbiter, String variableName, DartBlockValue? value) → void - Assign a value to an existing variable based on its name.
-
clearChildren(
) → void -
clearMemory(
) → void -
copyFrom(
DartBlockEnvironment environment) → void -
declareVariable(
DartBlockArbiter arbiter, String variableName, DartBlockDataType dataType, DartBlockValue? value) → void - Declare a variable using the given name and optionally the initial value.
-
get(
String variableName) → DartBlockValue? - Get the current value associated with the given variable name.
-
getAllValues(
DartBlockArbiter arbiter) → Map< DartBlockVariableDefinition, String?> -
getContainingEnvironment(
String variableName) → DartBlockEnvironment? - Search for the Environment which stores the value mapped to the given variable name (key). If a given key is not found in the current Environment, it may still be found in a higher up (parent) Environment, hence this function recursively searches for the parent Environment which contains this key.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setParent(
DartBlockEnvironment? parent) → void -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited