Changeset 13977


Ignore:
Timestamp:
06/17/12 18:20:32 (9 years ago)
Author:
rschlatte
Message:

Properly call remove-direct-method on class redefinition

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/clos.lisp

    r13976 r13977  
    853853                       (list +the-standard-object-class+)))))
    854854    (setf (class-direct-superclasses class) supers)
    855     ;; FIXME (rudi 2012-03-22: follow the AMOP spec here when classes
    856     ;; are reinitialized: call add-direct-subclass for newly-added
    857     ;; superclasses, call remove-direct-subclass for removed
    858     ;; superclasses
    859855    (dolist (superclass supers)
    860856      (add-direct-subclass superclass class)))
     
    36233619  (apply #'std-after-initialization-for-classes class args))
    36243620
     3621(defmethod reinitialize-instance :before ((class standard-class)
     3622                                          &key direct-superclasses
     3623                                          &rest all-keys)
     3624  (check-initargs (list #'allocate-instance
     3625                        #'initialize-instance)
     3626                  (list* class all-keys)
     3627                  class t all-keys
     3628                  nil 'reinitialize-instance)
     3629  (dolist (superclass (set-difference (class-direct-superclasses class)
     3630                                      direct-superclasses))
     3631    (remove-direct-subclass superclass class))
     3632  (dolist (superclass (set-difference direct-superclasses
     3633                                      (class-direct-superclasses class)))
     3634    (add-direct-subclass superclass class)))
     3635
     3636(defmethod reinitialize-instance :before ((class funcallable-standard-class)
     3637                                          &key direct-superclasses
     3638                                          &rest all-keys)
     3639  (check-initargs (list #'allocate-instance
     3640                        #'initialize-instance)
     3641                  (list* class all-keys)
     3642                  class t all-keys
     3643                  nil 'reinitialize-instance)
     3644  (dolist (superclass (set-difference (class-direct-superclasses class)
     3645                                      direct-superclasses))
     3646    (remove-direct-subclass superclass class))
     3647  (dolist (superclass (set-difference direct-superclasses
     3648                                      (class-direct-superclasses class)))
     3649    (add-direct-subclass superclass class)))
     3650
    36253651(defmethod reinitialize-instance :after ((class standard-class) &rest all-keys)
    36263652  (remhash class *make-instance-initargs-cache*)
     
    36283654  (%make-instances-obsolete class)
    36293655  (setf (class-finalized-p class) nil)
    3630   (check-initargs (list #'allocate-instance
    3631                         #'initialize-instance)
    3632                   (list* class all-keys)
    3633                   class t all-keys
    3634                   nil 'reinitialize-instance)
     3656  ;; KLUDGE (rudi 2012-06-17) this calls add-direct-subclass again
    36353657  (apply #'std-after-initialization-for-classes class all-keys)
    36363658  (map-dependents class #'(lambda (dep) (update-dependent class dep all-keys))))
     
    36423664  (%make-instances-obsolete class)
    36433665  (setf (class-finalized-p class) nil)
    3644   (check-initargs (list #'allocate-instance
    3645                         #'initialize-instance)
    3646                   (list* class all-keys)
    3647                   class t all-keys
    3648                   nil 'reinitialize-instance)
     3666  ;; KLUDGE (rudi 2012-06-17) this calls add-direct-subclass again
    36493667  (apply #'std-after-initialization-for-classes class all-keys)
    36503668  (map-dependents class #'(lambda (dep) (update-dependent class dep all-keys))))
Note: See TracChangeset for help on using the changeset viewer.