Changeset 14153


Ignore:
Timestamp:
09/19/12 14:34:44 (9 years ago)
Author:
rschlatte
Message:

Initialize shared slots upon class finalization.

  • Slots with :allocation :class can now be read without creating an instance beforehand.
  • Reported by Pascal Costanza
File:
1 edited

Legend:

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

    r14145 r14153  
    549549         (unless (slot-definition-location slot)
    550550           (let ((allocation-class (slot-definition-allocation-class slot)))
    551              (setf (slot-definition-location slot)
    552                    (if (eq allocation-class class)
    553                        (cons (slot-definition-name slot) +slot-unbound+)
     551             (if (eq allocation-class class)
     552                 ;; We initialize class slots here so they can be
     553                 ;; accessed without creating a dummy instance.
     554                 (let ((initfunction (slot-definition-initfunction slot)))
     555                   (setf (slot-definition-location slot)
     556                         (cons (slot-definition-name slot)
     557                               (if initfunction
     558                                   (funcall initfunction)
     559                                   +slot-unbound+))))
     560                 (setf (slot-definition-location slot)
    554561                       (slot-location allocation-class (slot-definition-name slot))))))
    555562         (push (slot-definition-location slot) shared-slots))))
Note: See TracChangeset for help on using the changeset viewer.