Commit f3542ace authored by Stas Boukarev's avatar Stas Boukarev
Browse files

map-type: Operate on all types, not just classes.

parent 0f2723fa
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -31,14 +31,21 @@
      (funcall function
               class (objects-of-class class)))))

(defun map-type (type function)
  (let ((type (if (eql type t)
                  'identifiable
                  type)))
(defun map-type-class (superclass function)
  (dolist (class (storage-data *storage*))
      (when (subtypep class type)
    (when (subtypep class superclass)
      (map nil function
             (objects-of-class class))))))
           (objects-of-class class)))))

(defun map-type (type function)
  (let ((class (and (symbolp type)
                    (find-class type nil))))
    (if class
        (map-type-class class function)
        (dolist (class (storage-data *storage*))
          (dolist (object (objects-of-class class))
            (when (typep object type)
              (funcall function object)))))))

(defmethod update-instance-for-different-class
    :after ((previous identifiable) (current identifiable) &key)