context property Null safety

T? context

Returns the nearest context this symbol table belongs to. Returns null if none was set within the entire tree.

This can be used to bind values to a this scope within a compiler.

Implementation

T? get context {
  SymbolTable<T>? search = this;

  while (search != null) {
    if (search._context != null) return search._context;
    search = search._parent;
  }

  return null;
}
void context=(T? value)

Sets a local context for values within this scope to be resolved against.

Implementation

set context(T? value) {
  _context = value;
}