SymbolTable<T> class Null safety

A hierarchical mechanism to hold a set of variables, which supports scoping and constant variables.

Constructors

SymbolTable({Map<String, T> values = const {}})
Initializes an empty symbol table.

Properties

allPublicVariables List<Variable<T>>
Helper for calling allVariablesWithVisibility to fetch all public variables.
read-only
allVariables List<Variable<T>>
Retrieves every variable within this scope and its ancestors.
read-only
context ↔ T?
Returns the nearest context this symbol table belongs to. Returns null if none was set within the entire tree.
read / write
depth int
The depth of this symbol table within the tree. At the root, this is 0.
read-only
hashCode int
The hash code for this object.
read-only, inherited
isRoot bool
Returns true if this scope has no parent.
read-only
parent SymbolTable<T>?
Gets the parent of this symbol table.
read-only
root SymbolTable<T>?
Resolves the symbol table at the very root of the hierarchy.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

add(String name, {T? value, bool? constant}) Variable<T>
Use create instead.
allVariablesOfVisibility(Visibility visibility) List<Variable<T>>
Use allVariablesWithVisibility instead.
allVariablesWithVisibility(Visibility visibility) List<Variable<T>>
Retrieves every variable of the given visibility within this scope and its ancestors.
assign(String name, T value) Variable<T>
Assigns a value to the variable with the given name, or creates a new variable.
clone() SymbolTable<T>
Creates a scope identical to this one, but with no children.
create(String name, {T? value, bool? constant}) Variable<T>
Create a new variable within this scope.
createChild({Map<String, T> values = const {}}) SymbolTable<T>
Creates a child scope within this one.
fork({Map<String, T> values = const {}}) SymbolTable<T>
Creates a forked scope, derived from this one. You may provide starter values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
put(String name, T value) Variable<T>
Use assign instead.
remove(String name) Variable<T>?
Removes the variable with the given name from this scope, or an ancestor.
resolve(String name) Variable<T>?
Finds the variable with the given name, either within this scope or an ancestor.
resolveOrCreate(String name, {T? value, bool? constant}) Variable<T>
Finds the variable with the given name, either within this scope or an ancestor. Creates a new variable if none was found.
toString() String
A string representation of this object.
inherited
uniqueName(String name) String
Returns a variation on the input name that is guaranteed to never be repeated within this scope.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String name) Variable<T>?
operator []=(String name, T value) → void