root property Null safety

SymbolTable<T>? root

Resolves the symbol table at the very root of the hierarchy.

This value is memoized to speed up future lookups.

Implementation

SymbolTable<T>? get root {
  if (_root != null) return _root;

  var out = this;

  while (out._parent != null) {
    out = out._parent!;
  }

  return _root = out;
}