code: public final boolean hasSlot(String name) {
      S scope = thisScope();
      while (scope != null) {
        if (scope.hasOwnSlot(name)) {
          return true;
        }
        scope = scope.getParent();
      }
      return false;
    }
docs: Returns true if a variable is declared in this or any parent scope.