X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fstd-class.lisp;h=8d9dde3bfd89ad5692fd08a7f26464cae72b7903;hb=bb8121bf453353ce2cadc85d9be7be05ca6248ff;hp=553e17d3294fc47ed0cf2832e43b7601d81659c3;hpb=fb03344c5e8388e0b16512f1cb662d8cf5d13972;p=sbcl.git diff --git a/src/pcl/std-class.lisp b/src/pcl/std-class.lisp index 553e17d..8d9dde3 100644 --- a/src/pcl/std-class.lisp +++ b/src/pcl/std-class.lisp @@ -310,8 +310,6 @@ (defmethod ensure-class-using-class ((class null) name &rest args &key) (multiple-value-bind (meta initargs) (ensure-class-values class args) - #+nil - (set-class-type-translation (class-prototype meta) name) (setf class (apply #'make-instance meta :name name initargs)) (without-package-locks (setf (find-class name) class)) @@ -410,27 +408,10 @@ (push old collect))))) (nreverse collect))) (add-direct-subclasses class direct-superclasses) - (update-class class nil) - (do* ((slots (slot-value class 'slots) (cdr slots)) - (dupes nil)) - ((null slots) (when dupes - (style-warn - ;; FIXME: the indentation request ("~4I") - ;; below appears not to do anything. Finding - ;; out why would be nice. -- CSR, 2003-04-24 - "~@~@:>" - class - dupes))) - (let* ((slot (car slots)) - (oslots (remove (slot-definition-name slot) (cdr slots) - :test #'string/= :key #'slot-definition-name))) - (when oslots - (pushnew (cons (slot-definition-name slot) - (mapcar #'slot-definition-name oslots)) - dupes - :test #'string= :key #'car)))) + (if (class-finalized-p class) + ;; required by AMOP, "Reinitialization of Class Metaobjects" + (finalize-inheritance class) + (update-class class nil)) (add-slot-accessors class direct-slots) (make-preliminary-layout class)) @@ -455,15 +436,7 @@ ;; some class is forthcoming, because there are legitimate ;; questions one can ask of the type system, implemented in ;; terms of CLASSOIDs, involving forward-referenced classes. So. - (let ((classoid (or (let ((layout (slot-value class 'wrapper))) - (when layout (layout-classoid layout))) - #+nil - (find-classoid name nil) - (make-standard-classoid - :name (if (symbolp name) name nil)))) - (layout (make-wrapper 0 class))) - (setf (layout-classoid layout) classoid) - (setf (classoid-pcl-class classoid) class) + (let ((layout (make-wrapper 0 class))) (setf (slot-value class 'wrapper) layout) (let ((cpl (compute-preliminary-cpl class))) (setf (layout-inherits layout) @@ -471,7 +444,7 @@ (map 'simple-vector #'class-wrapper (reverse (rest cpl)))))) (register-layout layout :invalidate t) - (setf (classoid-layout classoid) layout)))) + (set-class-type-translation class (layout-classoid layout))))) (mapc #'make-preliminary-layout (class-direct-subclasses class))))) @@ -784,16 +757,16 @@ ;;; or reinitialized. The class may or may not be finalized. (defun update-class (class finalizep) (without-package-locks - (when (or finalizep (class-finalized-p class)) - (update-cpl class (compute-class-precedence-list class)) - ;; This invocation of UPDATE-SLOTS, in practice, finalizes the - ;; class. - (update-slots class (compute-slots class)) - (update-gfs-of-class class) - (update-initargs class (compute-default-initargs class)) - (update-ctors 'finalize-inheritance :class class)) - (dolist (sub (class-direct-subclasses class)) - (update-class sub nil)))) + (when (or finalizep (class-finalized-p class)) + (update-cpl class (compute-class-precedence-list class)) + ;; This invocation of UPDATE-SLOTS, in practice, finalizes the + ;; class. + (update-slots class (compute-slots class)) + (update-gfs-of-class class) + (update-initargs class (compute-default-initargs class)) + (update-ctors 'finalize-inheritance :class class)) + (dolist (sub (class-direct-subclasses class)) + (update-class sub nil)))) (define-condition cpl-protocol-violation (reference-condition error) ((class :initarg :class :reader cpl-protocol-violation-class) @@ -890,7 +863,25 @@ (wrapper-instance-slots-layout nwrapper) nlayout (wrapper-class-slots nwrapper) nwrapper-class-slots (wrapper-no-of-instance-slots nwrapper) nslots - wrapper nwrapper)) + wrapper nwrapper) + (do* ((slots (slot-value class 'slots) (cdr slots)) + (dupes nil)) + ((null slots) + (when dupes + (style-warn + "~@~@:>" + class dupes))) + (let* ((slot (car slots)) + (oslots (remove (slot-definition-name slot) (cdr slots) + :test #'string/= + :key #'slot-definition-name))) + (when oslots + (pushnew (cons (slot-definition-name slot) + (mapcar #'slot-definition-name oslots)) + dupes + :test #'string= :key #'car))))) (setf (slot-value class 'finalized-p) t) (unless (eq owrapper nwrapper) (update-pv-table-cache-info class) @@ -1124,7 +1115,9 @@ (list class) (make-reader-method-function class slot-name) "automatically generated reader method" - slot-name))) + :slot-name slot-name + :object-class class + :method-class-function #'reader-method-class))) (defmethod writer-method-class ((class slot-class) direct-slot &rest initargs) (declare (ignore direct-slot initargs)) @@ -1138,11 +1131,14 @@ (list *the-class-t* class) (make-writer-method-function class slot-name) "automatically generated writer method" - slot-name))) + :slot-name slot-name + :object-class class + :method-class-function #'writer-method-class))) (defmethod add-boundp-method ((class slot-class) generic-function slot-name) (add-method generic-function - (make-a-method 'standard-boundp-method + (make-a-method (constantly (find-class 'standard-boundp-method)) + class () (list (or (class-name class) 'object)) (list class)