remove method Null safety

Variable<T>? remove(
  1. String name

Removes the variable with the given name from this scope, or an ancestor.

Returns the deleted variable, or null.

Note: This may cause resolve calls in forked scopes to return null. Note: There is a difference between symbol tables created via fork, createdChild, and clone.


Variable<T>? remove(String name) {
  SymbolTable<T>? search = this;

  while (search != null) {
    var variable = search._variables.firstWhereOrNull((v) => == name);

    if (variable != null) {
      return variable;

    search = search._parent;

  return null;