code: public boolean isEnclosing(Scope scope) {
          for (; scope != null; scope = scope.getParent()) {
              if (this == scope) {
                  return true;
              }
          }
          return false;
      }
docs: Returns true if this scope is the same as or a parent of the one given.