handle non-standard slot allocations when updating classes
[sbcl.git] / src / pcl / slots.lisp
index 1919d3b..9054a5a 100644 (file)
     instance
     (etypecase position
       (fixnum
-       (car (nth position (wrapper-instance-slots-layout (wrapper-of instance)))))
+       ;; In the vast majority of cases location corresponds to the position
+       ;; in list. The only exceptions are when there are non-local slots
+       ;; before the one we want.
+       (let* ((slots (wrapper-slots (wrapper-of instance)))
+              (guess (nth position slots)))
+         (if (eql position (slot-definition-location guess))
+             (slot-definition-name guess)
+             (slot-definition-name
+              (car (member position (class-slots instance) :key #'slot-definition-location))))))
       (cons
        (car position))))))
 \f