code: private Scope findScopeForType(TypeElement type) {
      Scope scope = peekScope();
      while (scope != null) {
        if (scope.kind != ScopeKind.METHOD && type.equals(scope.type)) {
          return scope;
        }
        scope = scope.outer;
      }
      return null;
    }
docs: Finds the non-method scope for the given type.