code: public Scope getEnclosingScope(Scope scope) {
          for (Scope s = this; s != null; s = s.getParent()) {
              if (s.isEnclosing(scope)) {
                  return s;
              }
          }
          return null;
      }
docs: Returns the innermost enclosing scope of this and the one given. If no
  enclosing scope exists, null is returned.