// TODO: maybe we have similar routine
 @Nullable
 public static ClassDescriptor getContainingClass(@NotNull DeclarationDescriptor descriptor) {
   DeclarationDescriptor containing = descriptor.getContainingDeclaration();
   while (containing != null) {
     if (containing instanceof ClassDescriptor && !isClassObject(containing)) {
       return (ClassDescriptor) containing;
     }
     containing = containing.getContainingDeclaration();
   }
   return null;
 }
 @NotNull
 public static DeclarationDescriptor getContainingDeclaration(
     @NotNull DeclarationDescriptor descriptor) {
   DeclarationDescriptor containing = descriptor.getContainingDeclaration();
   assert containing != null : "Should be called on objects that have containing declaration.";
   return containing;
 }